ASPN ActiveState Programmer Network
  ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups | Web Services
SEARCH
advanced | search help

Reference
ActivePython 2.4
Python Documentation
Language Reference
7. Compound statements
7.1 The if statement
7.2 The while statement
7.3 The for statement
7.4 The try statement
7.5 Function definitions
7.6 Class definitions

MyASPN >> Reference >> ActivePython 2.4 >> Python Documentation >> Language Reference >> 7. Compound statements
ActivePython 2.4 documentation


7.1 The if statement

The if statement is used for conditional execution:

if_stmt ::= "if" expression ":" suite
( "elif" expression ":" suite )*
["else" ":" suite]
Download entire grammar as text.

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.

See About this document... for information on suggesting changes.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState 2004 All rights reserved