From: Hugh Sasse Staff Elec Eng Date: 2002-07-10T19:01:40+09:00 Subject: Re: Case expressions and LHS of assignment.... On Wed, 10 Jul 2002, Peter Hickman wrote: > Perhaps you could use an array to hold you instance variables rather > than the 3 seperate ones. This then gives > > def initialize > @values = Array.new > (1..3).times { @value << "Initial" } > end > > def assign(x,y) > @values[x] = y > end > > Even shorter (especially without error checking :-) ) and much much clearer. You're taking the contrived, cut-down example too literally :-). The numbers were easier to type to test this out, I was using symbols in fact, :x, :y, and :z in the first place, but the problem is more general than that because a case statement can be used with anything that copes with ===. Thanks anyway :-), Hugh