From: William James Date: 2006-09-08T16:40:46+09:00 Subject: Re: continuing the next iteration YAD wrote: > Paul Lutus wrote: > > You may or may not have heard this, but jumping to a label is frowned upon > There's nothing wrong with a structured jump without a label. > > btw, next is listed in the manual along with break, redo, and retry. > > > but there is a "Continuation" class that can jump out of a complex nested > > structure. > > http://www.rubycentral.com/book/ref_c_continuation.html > > Well, it's a little on the clunky side, but it works. > > def doRows (grid,char) > (0...3).each do |row| > callcc do |nextRow| > (0...3).each do |col| > nextRow.call() if grid[row][col] != char > end > return true > end > end > return false > end def do_rows(grid, char) grid.each {|row| return true if row.all?{|c| c==char} } return nil end