From: Rick DeNatale Date: 2007-06-07T08:14:53+09:00 Subject: Re: code problems On 6/6/07, Robert Dober wrote: > > That is a good example I really like to build on it. > Thanks. > > Maybe I might add one thing which took me some minutes to work out ;) > the nil value for the cont variable comes from : puts "After call". Actually it comes from the puts "After callcc" as this change demonstrates; rick@frodo:/public/rubyscripts$ cat testcontin.rb def continuation puts "Before callcc" callcc {|lola| puts "In callcc";return lola} puts "After callcc" "returning" end puts "Begin" cont = continuation puts "Got cont #{cont.inspect}" if cont cont.call puts "After call" "Hello" end puts "All done" rick@frodo:/public/rubyscripts$ ruby testcontin.rb Begin Before callcc In callcc Got cont # After callcc Got cont "returning" testcontin.rb:12: undefined method `call' for "returning":String (NoMethodError) -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/