Hi,
In message "case with multiple expressions"
on 04/02/05, Hal Fulton <hal9000 / hypermetrics.com> writes:
|Is there anything wrong with this kind of solution?
|
| case [x,y,z]
| when [1,2,3] then #...
| when [1,2,4] then #...
| when [2,2,3] then #...
| else ...
| end
Hmm, if we define Array#=== as
def ===(other)
self.all?{|item| item === other}
end
You can do
case [x, y]
when [0..50, 150..200]
color = white
when [0..100, 0..50]
color = blue
when [50..100, 50..200]
color = gray
else
color = black
end
Just an idea...
matz.