Technically, Ruby doesn't have functions, but methods. However, a Ruby method behaves almost identically to functions in other language:
def double(n)
n * 2
end
This normal method/function takes a parameter n, doubles it and returns the value. Now let's define a higher order function (or met...