r/AskProgramming • • Jun 05 '26

Help beginner

What is difference between output and return. I have seen some videos and it says like return is for computer and output is for human. Is it like two seperate ways one is displayed and one is stored? If so then wouldn't it become same like a stored variable?

1 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/Fun-Ship-2026 Jun 05 '26

Well I am currently watching the CX50 series and just finished Scratch so would it safe to say standard output mean as a side effect which would mean any visual or audio affect if I am correct. I am though confused even with the definition what does function return value does? Like can you give me some example why we use the return value if we can just use a variable.

1

u/KingofGamesYami Jun 05 '26 edited Jun 05 '26

Well I am currently watching the CX50 series and just finished Scratch so would it safe to say standard output mean as a side effect which would mean any visual or audio affect if I am correct.

Scratch doesn't have any blocks that interact with the standard output stream. The closest approximation (and this is not close) would be defining a list and appending items to that list.

I am though confused even with the definition what does function return value does? Like can you give me some example why we use the return value if we can just use a variable.

In the early days of programming, that's exactly what we did, as functions really hadn't been defined as a concept yet.

The reason we have (and use) return values is because it carries significantly more semantic meaning for humans interacting with the code.