From: Daniel Schierbeck Date: 2006-07-26T05:00:13+09:00 Subject: Re: Defining a method with an argument with a default value Daniel DeLorme wrote: > Daniel Schierbeck wrote: >> First of all, you don't need the `if value' part -- when Ruby sees >> @value, it is immediately created, with the value nil > > Sorry for being pedantic but this is not quite true (although in this > case it doesn't make a difference): > > irb(main):001:0> @a = 1 if false > => nil > irb(main):002:0> b = 2 if false > => nil > irb(main):003:0> @c = nil > => nil > irb(main):004:0> defined? @a > => nil > irb(main):005:0> defined? b > => "local-variable" > irb(main):006:0> defined? @c > => "instance-variable" I know, but I was trying to simplify the problem :) Cheers, Daniel