A partner and I had to write a method for finding and returning the larger of two numbers. Below are our two variants. They both get the job done.
Is there any benefit or drawback from the way one is written?
Version A:
def larger_number(num1, num2)
if num1 < num2
return num2
end
return num1
end
Version B:
def larger_number(num1, num2)
if num1 > num2
return num1
else
return num 2
end
end