if / else
Do one thing or the other, depending on a condition.
if x > 0:
pass
else:
passExample
for x in [-90, -30, 30, 90]:
penup()
goto(x, 0)
if x > 0:
dot(30, "red")
else:
dot(30, "blue")
hideturtle()
Console bridge: text in, text out · In any playground, open Reference to copy these.
Do one thing or the other, depending on a condition.
if x > 0:
pass
else:
passfor x in [-90, -30, 30, 90]:
penup()
goto(x, 0)
if x > 0:
dot(30, "red")
else:
dot(30, "blue")
hideturtle()
Turn text made of digits, such as "12", into a whole number you can calculate with.
int(text)