# Help understanding which code is better?

**URL:** <https://www.ruby-forum.com/t/help-understanding-which-code-is-better/260866>\
**Category:** Uncategorized\
**Created:** [January 27, 2021, 6:41pm UTC](https://www.ruby-forum.com/t/help-understanding-which-code-is-better/260866 "2021-01-27T18:41:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laura.Keat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a87d85/32.png) [@Laura.Keat](https://www.ruby-forum.com/u/Laura.Keat)\
**Post date:** [January 27, 2021, 6:41pm UTC](https://www.ruby-forum.com/t/help-understanding-which-code-is-better/260866/1 "2021-01-27T18:41:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pcl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ecae2f/32.png) [@pcl](https://www.ruby-forum.com/u/pcl)\
**Post date:** [January 28, 2021, 12:52am UTC](https://www.ruby-forum.com/t/help-understanding-which-code-is-better/260866/2 "2021-01-28T00:52:09Z")

</div>

> [@Laura.Keat](#):
>
> Is there any benefit or drawback from the way one is written?

No. What makes you think there might be?
