Florian gave you the right solution, but to explain why, he should
have said the 'yield' keyword yields control of the code flow to a
block provided as a parameter (e.g., he provided 'puts x' as the block
parameter).

I suggest reading in the Pickage, Ruby for Rails, my book, or in your
favorite Ruby book about block parameters to understand more.

--Jeremy

On 2/23/07, Sharma Chelluri <rubyrailssharma / yahoo.com> wrote:
> Hi
>
> I am trying to execute this program from cookbook.
>
>        def endless_string_succession(start)
>     while true
>       yield start
>       start = start.succ
>     end
>   end
>
>    puts endless_string_succession 'aa'
>
> **********************************************
> Error messages that I am getting
>
> C:/rubyexmples/1_16.rb:8: warning: parenthesize argument(s) for future
> version
> C:/rubyexmples/1_16.rb:3:in `endless_string_succession': no block given
> (LocalJumpError)
>   from C:/rubyexmples/1_16.rb:8
>
> Any ideas?
>
> Thanks In advance,
> Sharma
>
> --
> Posted via http://www.ruby-forum.com/.
>
>


-- 
http://www.jeremymcanally.com/

My free Ruby e-book:
http://www.humblelittlerubybook.com/book/

My blogs:
http://www.mrneighborly.com/
http://www.rubyinpractice.com/