P
Paul
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)
....
yield parent
....
run(child,level+1)#yield????????
....
end
run(root,0){|node|
puts node.get_name
}
It will not work because i cant use the yield in the recursive call to
run.
Any ideas?
Thanks
Paul
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)
....
yield parent
....
run(child,level+1)#yield????????
....
end
run(root,0){|node|
puts node.get_name
}
It will not work because i cant use the yield in the recursive call to
run.
Any ideas?
Thanks
Paul