... | ... | @@ -532,7 +532,7 @@ If the block is called with more arguments than it can accept, the rest of the a |
|
|
|
|
|
### Default values of arguments
|
|
|
|
|
|
If the block is called with no arguments, we might want to assume that the programmer wants to compute something by using the implicit default value. This can be assigned at compile-time, by using the special `arg=value` syntax.
|
|
|
If the block is called with no arguments, or less arguments than expected, we might want to assume that the programmer wants to compute something by using the implicit default value. This can be assigned at compile-time, by using the special `arg=value` syntax.
|
|
|
|
|
|
```ruby
|
|
|
say { |a,b=1| a + b }.call(9); # prints the result of: 9 + 1
|
... | ... | |
... | ... | |