通常,我在仅由该方法或递归例程本身调用的方法中有一个递归例程:
def foo
...
bar
...
end
def bar
...
bar
...
end
但由于bar
没有在其他任何地方使用,我不想将它定义为一个方法,而是以某种方式将它放在调用它的方法中,如下所示:
def foo
...
bar {# some way to mark the recursive routine
...
bar # some way to call the recursive routine
...
}
...
end
这可能吗?