iNTERFACEWARE Products Manual > Learning Center > Learning Python > Conditional Statements and Loops > The elif Statement |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
You can use the elif statement to specify another condition to try when the condition specified by an if statement is not true. (elif is short for "else if".) For example:
In this example, Python first checks whether patientid is equal to 42113. Since it is not, Python then checks whether patientid is equal to 42007, which it is. The elif statement uses the same comparison operators as the if statement. The statements included with the elif condition must be indented.
|