什么是非本地返回?什么场景下有用?请举个例子来解释一下。
最佳答案
Here's a good article关于在 ruby block 上下文中使用非本地返回。
Ruby’s blocks support non-local-return (some references), which means that a return from the block behaves identically to returning from the block’s original context.
这基本上意味着您可以从函数调用 block ,并且该 block 能够从原始函数返回。
关于function - 什么是异地返回?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8897507/