From: David Alan Black Date: 2002-04-12T06:00:33+09:00 Subject: Re: Is this behavior correct? Hello -- On Fri, 12 Apr 2002, David Corbin wrote: > --cut-- > Hit ENTER or type command to continue > class Bar > def initialize(*children) > puts "Init "+children.to_s > end > end > > foo = Bar.new("Alpha"); > foo = Bar.new > ("Beta"); > --cut-- > --stdout-- > Init Alpha > Init > --stdout-- > > Ruby version: ruby 1.6.7 (2002-03-01) [i686-linux] > > If it is correct? If so, can someone point me at some documentation > about where whitespace is important to Ruby? Yes, it's correct. Use -w and you'll get a hint :-) $ ruby -w corbin.rb corbin.rb:9: warning: useless use of a literal in void context Init Alpha Init So the second Bar.new has no argument, and the ("Beta") is just sort of sitting there. I'm not sure of the exact formulation of the rule... (see Pickaxe), but the newline will be significant (end of statement) generally unless the line ends with a binary operator. puts 3 + 4 # => 7 puts 3 + 4 # => 3 (and maybe other circumstances I'm not thinking of) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav