From: "Wolfgang Nádasi-Donner" Date: 2007-05-22T22:35:04+09:00 Subject: Re: bug in ruby Robert Klemme schrieb: > On 22.05.2007 14:53, Brian Candler wrote: >> On Tue, May 22, 2007 at 09:41:03PM +0900, sairam MP wrote: >>> class Foo >>> ... >>> if false >>> bar = 2 # never executed >>> end >>> ... >>> p bar # prints nil >>> end >>> end >> But briefly: an assignment like "bar = 2" is seen at the time the >> program is *parsed* and means that an unqualified "bar" is treated >> as a local variable from that point onwards until the end of that scope. Whether or not it is >> scope. Whether or not it is actually *executed* makes no difference. > Additional reference material: > > http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html#UO It should be added in the documentation, that such an uninitialized local variable is set to the initial value "nil". Wolfgang N�dasi-Donner