hi !

I'm new to ruby and I'm currently testing the language. So I know I can
write this:

def hello()
    yield "hello world"
end

hello { |i| puts i }

This prints "hello world" on the console, cool.

Now I wonder if the following code is valid :

p = Proc.new { yield "hello world" }

p.call { |i| puts i }

when I execute this I get the following error :
LocalJumpError: no block given
        from (irb):83
        from (irb):85:in `call'
        from (irb):85
        from :0


I belived Proc.call was equivalent to a standard method call, it seems
I'm wrong :). Did I misunderstand something? Can someone tell me where I
made a mistake?

Thank you

-- 
Posted via http://www.ruby-forum.com/.