0

Returning values from methods

def calc (a,b) return a*a, b*b, a*b end puts calc(3,2).length why is the output 3?

9th Nov 2016, 6:12 AM
Вячеслав Серков
Вячеслав Серков - avatar
3 Respostas
+ 3
because the method Returns an Array with the Square of a, the Square of b and the product of a and b ---> 3 different results
9th Nov 2016, 3:38 PM
Kevin Wrona
Kevin Wrona - avatar
+ 1
because if return has multiple values it returns them in an array
13th Nov 2016, 10:11 AM
Devon Chaffe
Devon Chaffe - avatar
0
Thank you!
9th Nov 2016, 3:41 PM
Вячеслав Серков
Вячеслав Серков - avatar