From: Peter Hickman Date: 2003-05-19T18:38:09+09:00 Subject: A recursive each method and a code block I have a simple search program that uses the each method with a yield to pass back results as it finds it. However in depth first search the method recurses at when it attempts the yield I get: ./search.rb:82:in `each': no block given (LocalJumpError) from ./search.rb:77:in `each' from ./search.rb:77:in `each' The code is: class DepthFirstSearch < GeneralSearch def each(list = @partials) # Declaring this variable outside the loop speeds things up temp = '' list.each {|p| @nextitems.each {|n| temp = [ p.map {|x|x}, n ].flatten if is_valid(temp) then if is_result(temp) then @solutions += 1 yield temp else @checked += 1 each([temp]) end end } } end end I suspect the problem is, through various fiddling, that the code block is not accessable to the subsequent recursion of the each method. Any clues how to get this to work?