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 adlt"
when 25…49 : "adlt”
when 50…64 : “middle aged”
when > 65 : “senior”
else : “not an age”
(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?
postscript - it seems the word 'adlt triggers the spam filter. hence
the odd wording above.