On Dec 8, 2005, at 8:11 PM, Steve Litt wrote: > On Thursday 08 December 2005 06:06 pm, Jacob Fugal wrote: >> On 12/8/05, Steve Litt <slitt / earthlink.net> wrote: >>> Except I can't put in the parentheses: >>> >>> #!/usr/bin/ruby >>> my_array = ["alpha", "beta", "gamma"] >>> puts (my_array.collect do >>> >>> |word| >>> >>> word.capitalize >>> end) >>> >>> Output: >>> [slitt@mydesk slitt]$ ./test.rb >>> ./test.rb:3: syntax error >>> ./test.rb:6: syntax error >> >> Take out the space between puts and the open paren: > > Confirmed! Thanks Jacob. This is the first time I've seen Ruby > conflict with > the Rule of Least Surprise (http://www.faqs.org/docs/artu/ > ch11s01.html). > > Is there any chance of a Ruby change so as not to require the paren > to be > flush up against the function name? > > Thanks > > SteveT > Doubtful. Matz. has been trying to move in the opposite direction: irb(main):003:0> puts ("Hello", "World") (irb):3: warning: don't put space before argument parentheses Hello World => nil > Steve Litt > http://www.troubleshooters.com > slitt / troubleshooters.com >