| Python Language Reference Manual by Guido van Rossum and Fred L. Drake, Jr. Paperback (6"x9"), 120 pages ISBN 0954161785 RRP £12.95 ($19.95) Sales of this book support the Python Software Foundation! Get a printed copy>>> |
7.1 The if statement
The if statement is used for conditional execution:
if_stmt "if"expression":"suite-
( "elif"
expression":"suite)* ["else" ":"suite]
It selects exactly one of the suites by evaluating the expressions one
by one until one is found to be true (see section 5.10 for
the definition of true and false); then that suite is executed (and no
other part of the if statement is executed or evaluated). If
all expressions are false, the suite of the else clause, if
present, is executed.
| ISBN 0954161785 | Python Language Reference Manual | See the print edition |