How To Get Multiple Return Values From A Method
I thought this was cool.
Note the square brackets, which make the method return an array.
def foo(x)
[x+5, x*9]
end
a,b = foo(10)
p a #=> 15
p b #=> 90
I thought this was cool.
Note the square brackets, which make the method return an array.
def foo(x)
[x+5, x*9]
end
a,b = foo(10)
p a #=> 15
p b #=> 90