Why not ruby replace the Block with lambda?

Where there is a will, there is a way. Some times when you are programming in C# or python, you may think about is there a way to break out of a function block to it’s parent scope?

We learned that in C we could use goto to jump around the codes. That’s a great tool when you need to jump out of deep nested loops. But you can’t jump out of a function with this tricky tool. If you learned about POSIX C, the longjump can meet the need, though it’s intended to easier the complexity in error handling. Requirement like jumping out of a function is really rare when coding. We always can find out a solution. Such as try catch in C++ or C#.

Lua code fragment below, you can’t stop the code from going through all the numbers. The permutation is a system predefined function, and we cannot modify it.

But Ruby can complete the task with Block like below:

The differences make the existence of things reasonable.