Help understanding which code is better?

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

No. What makes you think there might be?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs