Next / Previous / Contents / Shipman's homepage

23.7. The return statement: Exit a function or method

Within any function or method, you can exit the function with a return statement. There are two forms:

return expression

In the first form, execution resumes at the point where the function or method was called, and the value of the expression is substituted into the calling statement.

The second form is the equivalent of “return None”. (See Section 18, “None: The special placeholder value”.)