I feel like this should be simple but i can't figure it out.

In a case statement, i know how to use ranges to compare against the
given variable.  But how do i use < or > ?  eg i want to do this:

age = 25

category = case age
  when < 12 : "child"
  when 13..17 : "minor"
  when 18..24 : "young ad*lt"
  when 25..49 : "ad*lt"
  when 50..64 : "middle aged"
  when > 65   : "senior"
  else        : "not an age"
end

(please don't anybody be offended by my age categories, i just made up
this example off the top of my head)

Anyway, the above doesn't work - syntax error.
Neither does this:

when age < 12 : "child"

the test doesn't pass, so if age is eg 10, i get nil back.

Can someone set me straight?
thanks
max

*******************************
postscript - it seems the word 'ad*lt* triggers the spam filter.  hence
the odd wording above.
-- 
Posted via http://www.ruby-forum.com/.