From: Mini Skirt Date: 2008-08-14T07:21:00+09:00 Subject: case statement and ranges Hey, I want to do something like that: case amount when 25..50: 42 when 51..66: 78 when 90..123: 99 end which works of course. Now what I would like to have some other cases like when amount is lower that 25, but with no minimum, or when it is higher that 123 ... I could write something like: case when amount === (25..50): 42 when amount === (51..66): 78 when amount === (90..123): 99 when amount < 25: 100 when amount > 123: 200 else 0 # this would happen only when amount is in 67...90 end But it doesn't feel that well ... since I am repeating my amount variable all the time and this is precisely what the 'case something' construct is about. I cold also use some extremely high and extremely low values in ranges, like (123..100000000) or (-10000000..25) to handle the other cases since I know that in my use, it would be fine. But it does look quite inelegant .... thx -- Posted via http://www.ruby-forum.com/.