1/6
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
return;
A return form that exits the function without returning a value (used in void functions).
return some_expression_or_value;
A return form that exits the function and returns a value produced by an expression or literal.
It returns control (and possibly a value) to the caller—more precisely to the function call expression.
What return Actually Returns To?
Return Terminates the Function
Once a return statement executes, the function exits immediately.
Code After return Is Not Executed
Any statements written after a return statement in the same execution path will never run.
Multiple Return Statements
A function may contain more than one return statement, and whichever is reached first returns control/value immediately.
Conditional Returns
Return statements can be selected by conditions (e.g., returning 1, -1, or 0 depending on input).