Should return statement always display on the console?


I’m not far into learning Ruby (which is great fun) but I’m very confused about method returns.

The instructions seem to imply that using a return statement in a method should display something in the console (similar to how would puts) but it never does for me.

Even when I copy and paste the examples they don’t work as I imagine. i.e.

def double(n)
return n * 2

Do I just have the wrong idea or am I missing something?

Cheers in advance


no? Do you have the instructions you are referring to? Return doesn’t print to the console, it means the function hands something back. Then you can put puts before the function call to print the returned result


Thanks stetim,

I’m glad to hear that. It makes a lot more sense. I guess I was misunderstanding them