+ 2

What is the diference between return and puts?? Does it do the same thing?

9th Nov 2016, 11:06 AM
Nayomal
Nayomal - avatar
2 Answers
+ 4
puts print the value. return send the value back from a function to another variable for later usage.
9th Nov 2016, 2:20 PM
Burey
Burey - avatar
+ 1
You might be confused because you see most methods don't include a return statement. That's because ruby will implicitly return the last thing it evaluated before the end word.
17th Jan 2017, 10:13 AM
Mariano Giagante
Mariano Giagante - avatar