Friday, April 27, 2007

warning: multiple values for a block parameter (0 for 1)

In the following irb session the error message indicates that the input parameter is missing.

>> hello = lambda { "hello" }
=> #
>> hello.call
=> "hello"
>> log = lambda { |str| puts "[LOG] #{str}" }
=> #
>> log.call
(irb):16: warning: multiple values for a block parameter (0 for 1)
from (irb):17
[LOG]
=> nil
>> log.call("A test log message")
[LOG] A test log message
=> nil

No comments:

Post a Comment