Answer the question
In order to leave comments, you need to log in
Can a method know how many output values are expected from it?
Suppose there is a method that returns two values.
def connect()
return [1, nil]
end
a, b = connect()
# => a == 1
# => b == nil
a = connect()
# => a == [1, nil]
a = connect()
# => a == 1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question