From: Roger Lipscombe Date: 2001-08-23T18:46:54+09:00 Subject: [ruby-talk:20172] Recursively passing blocks... I was attempting to implement a recursive directory walker (before someone pointed me at Find.find), but this question remains... class Dir def Dir.walk(path, &block) # ...stuff if something walk(child, block) else block.call(child) end end end Dir.walk(".") { |f| puts f } If I pass two arguments to walk, I get an error, because it's only expecting one. If I pass only one argument to walk, I get an error when trying to call the block, because it's nil. So, what's the correct way to pass a block to a recursive algorithm? Cheers, Roger.