Paul wrote:def run(parent, level, &block)> Hi,
> How do I pass a ruby function as an argument to another ruby function so
> that it can be used as a callback?
> Also, I have a recursive tree traversing function that I would like to
> use yield with. For example:
> def run(parent,level)block.call(parent)> ....
> yield parentrun(child,level+1, &block)> ....
> run(child,level+1)#yield????????The first use of the "&block" notation converts the caller-supplied> ....
> puts node.get_name
> It will not work because i cant use the yield in the recursive call to
block to an instance of Proc and stores it in "block".
The second use of "&block" passes the proc object as the caller-supplied
block of the recursive call to #run.