From: Christoph Date: 2002-05-22T22:20:02+09:00 Subject: Re: Rewrite this without using eval... "Gray, Jeff" wrote in .... > -- > class Foo > def initialize > @a = 1 > @b = 2 > end > > def inc_iv > [:@a, :@b].each { |iv| > eval "#{iv} += 1" > } > end > end > -- Hi, what about? --- class Foo def initialize @a = 1 @b = 2 end def inc_iv [@a, @b].collect! { |iv| iv+=1 } end end --- /Christoph