# \[new to ruby\] implicit function return values?

**URL:** <https://www.ruby-forum.com/t/new-to-ruby-implicit-function-return-values/166806>\
**Category:** Rails\
**Created:** [April 29, 2009, 7:07pm UTC](https://www.ruby-forum.com/t/new-to-ruby-implicit-function-return-values/166806 "2009-04-29T19:07:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cban1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cban1](https://www.ruby-forum.com/u/cban1)\
**Post date:** [April 29, 2009, 7:07pm UTC](https://www.ruby-forum.com/t/new-to-ruby-implicit-function-return-values/166806/1 "2009-04-29T19:07:28Z")

</div>

I’m sure this is a trivial question, but I’m a java/C programmer and  
am not used to implicit returns.

If I have a function:

def check\_range ( num )  
rng = 0…10

rng.include?( num )  
end

… does check\_range evaluate to true or false depending on whether  
‘num’ is in the range (based on the last line of the function)?

Is the implicit return basically just “the last thing the function  
evaluated” ?

---

<div class="post-metadata">

**Author:** ![cban1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b38774/32.png) [@cban1](https://www.ruby-forum.com/u/cban1)\
**Post date:** [April 29, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/new-to-ruby-implicit-function-return-values/166806/2 "2009-04-29T19:09:14Z")

</div>

On Apr 29, 5:00 pm, cban1 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> … does check\_range evaluate to true or false depending on whether  
> ‘num’ is in the range (based on the last line of the function)?

try it 🙂

> Is the implicit return basically just “the last thing the function  
> evaluated” ?

Yup

Fred
