From: Joel VanderWerf Date: 2005-03-07T10:54:46+09:00 Subject: Re: What is reason for callcc{|c|c}? Luke Graham wrote: > The block usually wants to return a useful value itself. > > > On Mon, 7 Mar 2005 08:16:17 +0900, Joel VanderWerf > wrote: > >>Joel VanderWerf wrote: >> >>>2. So a result can be passed to the continuation. >> >>Duh. Of course you can do that with >> >> c = callcc { |c| c } >> >>as the article says. The first time through, the value assigned to c >>will be the continuation. The second time (after c.call(x)), the value >>assigned to c will be arg x. Just to clarify, this is how c can be assigned a return value other than the continuation: c = callcc { |c| c } p c c.call(3) if c.respond_to?(:call) Output is: # 3