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 resultThe return statement stops function execution and optionally passes back a result to the caller.

  1. A.

    To print values

  2. B.

    To stop function execution and optionally pass back a result

  3. C.

    To define a function

  4. D.

    To take input from the user

Attempted by 314 students.

Show answer & explanation

Correct answer: B

The return statement stops function execution and optionally passes back a result to the caller.

Explore the full course: Rssb Senior Computer Instructor

Loading lesson…