I need help answer and why so

“why must you use return function when you can use void and print out”

Printing only outputs to the console (the screen). It doesn’t actually store or affect data. Returning data is a good way to pass it or modify it.

Think of it like an ATM machine, that the screen shows you you have money only helps to inform you, it is a pointer to the idea that you have money. The actual reason you have money is because you worked, received money, and stored it in the bank. That process is closer to what returning does in programming.

2 Likes

Another analogy…

The console is like the oven door; through it, you can see that there is a cake baking.

You only get the cake when it’s done, and you take it out of the oven. That, in essence, is the return. :slight_smile:

1 Like

I’m stealing that. Consider it stolen.

2 Likes