CBSE · 083Class XII · 2025Section B2 marks

Question 22

4 March 2025 · Computer Science (083)

What does the return statement do in a function ? Explain with the help of an example.

Answer

It exits the function and passes a value back to the caller. Example:

python
def Add(A,B): return A+B
print(Add(5,3)) # Outputs 8

Explanation

The return statement terminates function execution and specifies the value to be returned to the function caller.