From: Minkoo Seo Date: 2006-02-14T16:23:26+09:00 Subject: Continuation in ruby Hi all. I've written the following code to learn continuations in ruby only to fail. Please have a look at: def print_num for i in (1..10) puts i if i % 2 == 0; callcc{|c| return c}; end end end cont = print_num puts "Yae, I love even~" cont.call puts "Bye" This code produces: C:\WINDOWS\system32\cmd.exe /c ruby a.rb 1 2 Yae, I love even~ 3 4 Yae, I love even~ 5 6 Yae, I love even~ 7 8 Yae, I love even~ 9 10 Yae, I love even~ Yae, I love even~ a.rb:10: undefined method `call' for 1..10:Range (NoMethodError) shell returned 1 Hit any key to close this window... This is contrary to my intuition. I've called cont.call only once, and cont.call should put the following command, put "bye", into stack. I can't figure out the reason why cont.call is called indefinitely. Best, Minkoo Seo