In the context of programming, what does Return do?

553 views

I’m trying to pick up computer programming yet again, and I’m not really understanding the use of Return. What is it? How would you use it?

In: Technology

5 Answers

Anonymous 0 Comments

Computer works by breaking everything it does in small tasks. Let’s call those tasks as “functions”. Imagine functions as magic boxes, they could have zero, one or more inputs and return one output. Internally, those functions are also made combining another functions.

When a function returns, it could:

-Return a value. Like you’ve asked how much is 1+2? 3.
-Return it finished what it was doing. Call me “John”. Ok.
-Return that an error has occurred. How much is 1/0? Don’t know how to continue.

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