#!/usr/bin/ruby
#
## https://rosettacode.org/wiki/Higher-order_functions
#
func first(f) {
return f();
}
func second {
return "second";
}
say first(second); # => "second"
say first(func { "third" }); # => "third"
#!/usr/bin/ruby
#
## https://rosettacode.org/wiki/Higher-order_functions
#
func first(f) {
return f();
}
func second {
return "second";
}
say first(second); # => "second"
say first(func { "third" }); # => "third"