The keyword return is compulsory in
-
Procedure definition
-
Function definition
-
both A & B
-
Option in both A & B
Reveal answer
Fill a bubble to check yourself
B
Correct answer
Explanation
Functions MUST include a RETURN statement because they are designed to compute and return a value. Procedures can execute without returning anything. The RETURN keyword is compulsory in function definitions to specify what value is computed and sent back to the caller.
AI explanation
A function is defined specifically to compute and hand back a value, so a return statement carrying that value is required for the function to fulfill its purpose. A procedure (or subroutine) is executed purely for its side effects and doesn't have to return a value, so return is optional there.