What is the purpose of the return statement in a function?
2025
What is the purpose of the return statement in a function?
Answer: B. To stop function execution and optionally pass back a result — The return statement stops function execution and optionally passes back a result to the caller.
- A.
To print values
- B.
To stop function execution and optionally pass back a result
- C.
To define a function
- D.
To take input from the user
Attempted by 312 students.
Show answer & explanation
Correct answer: B
The return statement stops function execution and optionally passes back a result to the caller.
Loading lesson…