From: Hugh Sasse Staff Elec Eng Date: 2002-07-10T18:36:32+09:00 Subject: Case expressions and LHS of assignment.... While trying to avoid Repetition in my code I tried to rewrite a case statement, thinking how they can be used on the right hand side of an assignment, so I tried the left hand side. It basically came down to this: #!/usr/local/bin/ruby -w class Lvalue def initialize @a = @b = @c = "initial" end def assign(x,y) (case x when 1 @a when 2 @b when 3 @c end) = y end end lvalue = Lvalue.new lvalue.assig(2,"Different") p lvalue __END__ but this gives: /home/hgs/progs/ruby/lvalue1.rb:15: parse error end) = y ^ I tried leaving the () off too. I was not really surprised when it failed, but I was left wondering about it. In an ideal world is this desirable, or is it complicating things too much? I bet it would complicate the parser. Is it even sensible? This might not lead to Repetition, but may lead to Deviation (http://www.bbc.co.uk/radio4/comedy/justaminute.shtml)! Hugh (possibly thinking too far outside the box!)