The result a function gives back after it runs.
Details
Some functions perform a task and give back a value that can be used later in the program.
For example, a function that adds two numbers might return their sum:
🤖 Pseudocode
function add(a, b): return a + b
This function accepts two parameters a and b and returns the sum of their values.
When the program calls the function, it receives the returned value and can use it as needed.
A common use is storing it in a variable or using it in an expression:
🤖 Pseudocode
int sum = add(1, 2); # Declares a variable with the function return value (3)
Related Concepts
- Exists in: Function