[new to ruby] implicit function return values?


#1

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” ?


#2

On Apr 29, 5:00 pm, cban1 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 :slight_smile:

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

Yup

Fred