Explain in layman’s term why we need to use ‘return’ statement in programming ?

996 views

Explain in layman’s term why we need to use ‘return’ statement in programming ?

In: Technology

6 Answers

Anonymous 0 Comments

Imagine that you and your buddy are working together to build something, but you’re in two different rooms, each doing different things. You get to a point in your work where you need something from your buddy before you can continue. You shout your request over to them, then wait patiently for the answer.

Your buddy hears you shouting, and does what you ask. A “return” statement is them shouting the answer back to you. Without one, your buddy would do what you asked, and then just…be done doing what you asked. You’d have no way to know what their answer was.

You are viewing 1 out of 6 answers, click here to view all answers.