concept function in category ruby

appears as: function, functions, function
The Well-Grounded Rubyist, Third Edition

This is an excerpt from Manning's book The Well-Grounded Rubyist, Third Edition.

Although it’s important in its own right, the fact that blocks share local scope with the code that precedes them will take on further significance when we look at Proc objects and closures in chapter 14. You’ll learn that blocks can serve as the bodies of anonymous function objects, and those objects preserve the local variables that are in scope at the time of their creation—even if the function objects get handed around other local scopes.

For the sake of conciseness, the term proc (in regular font) will serve in the text to mean Proc object, much as string refers to an instance of the class String. Lambda will mean an instance of the lambda style of Proc object. (Don’t worry; you’ll see what that means soon!) The term function is a generic term for standalone units of code that take input and return a value. There’s no Function class in Ruby. Here, however, you’ll sometimes see function used to refer to procs and lambdas. It’s just another, slightly more abstract way of identifying those objects.