From: Logan Capaldo Date: 2006-08-17T00:06:49+09:00 Subject: Re: goto function? On Aug 16, 2006, at 7:55 AM, Christian Neukirchen wrote: > "David Vallner" writes: > >> The BASIC construct of "goto" is rightfully considered harmful for >> programs above a certain complexity. It's not present in Ruby in any >> direct way that would let you jump around a program's structure >> arbitrarily. (Actually, that's a lie, but I'll hold the continuations >> for the sake of simplicity.) > > It is often said that continuations are as powerful as goto. > But is there a way to jump *forward* with continuations, without > rewriting the code to use additional methods? > Jumping forward: callcc do |cc| puts "Some code" puts "Some more code" cc.call # jump forward puts "I'm never executed" end puts "Whee!" >> David Vallner > -- > Christian Neukirchen http:// > chneukirchen.org >