From: gwtmp01@... Date: 2006-08-16T06:50:53+09:00 Subject: Re: goto function? On Aug 15, 2006, at 5:28 PM, Logan Capaldo wrote: > I wouldn't recommend making this a habit but: > > % cat cc.rb > x = 0 > bar = callcc {|cc| cc} > puts "Hello" > x += 1 > bar.call(bar) unless x == 3 > puts "x is #{x}" Yikes, someone asks questions which indicate that they are a novice programmer and you throw continuations at them? Isn't that like throwing someone in the deep end of the pool and seeing if they can swim? Or maybe it is like holding them under water and seeing if they have gills? :-) Fasby wrote: > I don't really understand.. > > I want the script to start over again.. for example.. > When the user made an input and pressed return I want the script to > "restart" or jump to the beginning.. You can use 'next' to begin the next iteration of a loop: loop { # your code here if startover? next # will cause loop to start over end # more stuff here if quit? break # to get out of the loop entirely end # more stuff here } Gary Wright