+ 2
What is the diference between return and puts?? Does it do the same thing?
2 Antworten
+ 4
puts print the value.
return send the value back from a function to another variable for later usage.
+ 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.