|
|
|
|
|
by jes5199
2067 days ago
|
|
yes, exactly! Anonymous functions weren't as common in other languages when Ruby first got popular, so the older Ruby devs had to learn about blocks without talking about anonymous functions, and I think they mostly haven't realized that the world has changed and there's a common terminology that people coming in from other languages will know. The one big quirk is that Ruby syntax doesn't let you assign a block to a variable like you can assign a function to a variable in javascript. But you can work around that by using the lambda keyword or Proc.new with a block, which will wrap it into an object. Then you can use the & sigil to pass that object into a method that's expecting a block |
|