Next: variable, Previous: reply, Up: Imperative Statements [Contents][Index]
returnreturn is used to return program execution from the body of a
function to the caller, possibly providing a value.
Implicitly returning from a void function is allowed. Also it is
not required to use return as the last statement of a void
function, i.e., an early return skipping over remaining statements is
allowed.
return ::= "return" ";"
| "return" expression ";"
For example:
void foo ()
{
if (idle) return;
world;
}
bool negate (bool b)
{
return !b;
}