[OCLUG-devel] Ruby - Default Method Args
Doug Jolley
ddjolley at gmail.com
Mon Mar 5 09:43:42 PST 2007
Are there any Ruby programmers on the list that can
explain to me why this snippet of code:
def foo(a,b="four",c)
puts("Arg1: #{a}")
puts("Arg2: #{b}")
puts("Arg3: #{c}")
end
foo('one','two','three')
produces these errors:
./test1.rb:3: syntax error, unexpected ')', expecting '='
./test1.rb:7: syntax error, unexpected kEND, expecting $end
instead of this result:
Arg1: one
Arg2: two
Arg3: three
Thanks for any input.
... doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://localhost.localdomain/pipermail/oclug-devel/attachments/20070305/1becf2e0/attachment.html
More information about the OCLUG-devel
mailing list