Sometimes it is necessary to change or to return multiple parameters in method. While passing a parameter by reference is a bit tricky in Ruby, returning multiple values from a method is simple. One can return for instance a hash, or simply write

    return true, 42

which is equivalent to returning the results as an array:

    return [true, 42]
Advertisements