Name

if

Examples
for i in range(5, height, 5):
    stroke(255)     # Set the color to white
    if i < 35:      # When 'i' is less than 35...
        stroke(0)   # ...set the color to black
    line(30, i, 80, i)
Description Allows the program to make a decision about which code to execute. If the test evaluates to True, the statements enclosed within the block are executed and if the test evaluates to False the statements are not executed.
Syntax
if test: 
  statements 
Parameters
testany valid expression that evaluates to True or False
statementsone or more statements to be executed
Related else

Updated on Tue Feb 27 14:07:12 2024.

If you see any errors or have comments, please let us know.