From: Gavin Kistner Date: 2005-11-24T13:05:54+09:00 Subject: Re: syntax error warning: useless use of a variable in void context On Nov 23, 2005, at 3:57 PM, Christophe Grandsire wrote: > The only ways to make this work is: > - to make the instance variable @a readable with "attr_reader :a" > and replace "tlr.@a" with "tlr.a" > - to bypass encapsulation by replacing "tlr.@a" with > "tlr.instance_variable_get(:@a)". To be pedantic: a) attr_reader doesn't make an instance variable readable, it's a convenient way to add a method that returns the value of the instance variable. b) There are other ways (variations on your latter) such as tlr.instance_eval{ @a }