This program not working?

I tried to run this program (see attached) and got this following error:

…rb:42: syntax error, unexpected ‘.’, expecting ‘|’
callcc { |song.wall| song.of(99) }.sing { |beer| beer.drink }
^
…rb:42: syntax error, unexpected ‘}’, expecting $end
callcc { |song.wall| song.of(99) }.sing { |beer| beer.drink }
^

Is there a way to fix this? Thanks.

On Thu, Mar 28, 2013 at 11:27 AM, Vincent S.
[email protected] wrote:

I tried to run this program and got this sollowing error:

…rb:42: syntax error, unexpected ‘.’, expecting ‘|’
callcc { |song.wall| song.of(99) }.sing { |beer| beer.drink }
^

You can’t use a method call within the vertical bars (pipes); it has
to be the name of a variable which is local to the block.

…rb:42: syntax error, unexpected ‘}’, expecting $end
callcc { |song.wall| song.of(99) }.sing { |beer| beer.drink }
^

I’m not sure about this error, but it’s probably a continuation of the
previous one.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs