From: Graham Foster Date: 2004-09-23T07:34:41+09:00 Subject: Newbie: Case statement As a newbie I'm confused about the Case construct. All the documentation I've found states "case operates by comparing the target with EACH of the expressions after the When keyword" This does NOT appear to happen, as only the first match is ever actioned, so overlapping WHEN cases are skipped. def test(x) case x when 1..2 print "In A\n" when 1..3 print "In B\n" when 2..4 print "In C\n" end end test(2) only outputs "In A" I assume this is expected behaviour? (I'm ex-C - and was looking for fall-through behaviour) So my underlying question is:- what's the fastest Ruby for checking which of the 8 possible adjacent cells on a board (2D array) are still "on the board" Thx Graham