This function should work, but when I wrote it, I had the feeling that
there would be a much better way to code this function. In particular, I
don't let creating the discount_out variable. anyone want to give me a
nudge in the right direction?

def discount(discount_category)
    #    0 => no discount
    #    1 => friend
    #    2 => vet
    #    3 => super-vet
    case discount_category
    when 1
      discount_out = 40
    when 2
      discount_out = 100
    when 3
      discount_out = 160
    else
      discount_out = 0
    end
    discount_out
  end

best,

tim
-- 
Posted via http://www.ruby-forum.com/.