what is the point of return in ruby?
Posted
by
Sam
on Stack Overflow
See other posts from Stack Overflow
or by Sam
Published on 2011-01-05T06:42:47Z
Indexed on
2011/01/05
6:53 UTC
Read the original article
Hit count: 259
What is the difference between return
and just putting a variable such as the following:
return
def write_code(number_of_errors)
if number_of_errors > 1
mood = "WTF"
else
mood = "No Problem"
end
mood
end
no return
def write_code(number_of_errors)
if number_of_errors > 1
mood = "WTF"
else
mood = puts "No Problem"
end
return mood
end
© Stack Overflow or respective owner