Test Index
CBSE Class 12 Computer Science 2025 Paper Set 4
© examsnet.com
Question : 22 of 37
Marks:
+1,
-0
What does the
return statement do in a function ? Explain with the help of an example.
Solution:
Concept:The
return statement ends the execution of a function and sends a value (the result) back to the statement that called the function. The returned value can be stored in a variable, printed or used in an expression. Statements written after return inside the function are not executed. A function with no return (or with a bare return) returns None.Example:def Add(A, B): return A + B # sends the sum back to the callerResult = Add(5, 3) # returned value 8 is stored in Resultprint(Result)Output:
8Here
Add(5, 3) computes , the return statement passes 8 back to the caller, and it is stored in Result.© examsnet.com
Go to Question: