Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?

Proc vs. Lambda

A lambda is an anonymous method.

Since it's a method, it returns a value, and the method that called it can do with it whatever it wants, including ignoring it and returning a different value.

A Proc is like pasting in a code snippet. It doesn't act like a method. So when a return happens within the Proc, that's just part of the code of the method that called it.

Credits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment