iNTERFACEWARE Products Manual > Learning Center > Learning Python > Conditional Statements and Loops > The if Statement |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
In Python, you use the if statement to define code that is to be executed only when a specified condition is true. Here is a simple example of code that contains an if statement:
In Python, the symbol == means "is equal to". In this code, patientid == 42113 is the condition that must be satisfied to execute the code; this condition is known as a conditional expression. It tells Python that the print statement is only to be executed if the value stored in patientid is equal to 42113. Since it is not, the print statement is not executed. |