|
|
|
|
|
by pwim
4861 days ago
|
|
One point about "Functions as variables". Ruby actually does have method objects, which you can access via the method method. def add(a,b)
a+b
end
def process_numbers(a,b,method)
func.call(a,b)
end
method(:add) => #<Method: Object#add>
process_numbers(1,2,method(:add)) => 3
This isn't a normal programming paradigm in Ruby though. |
|