← Reference

Numbers from text: cheat sheet

Console bridge: text in, text out · In any playground, open Reference to copy these.

if / else

Do one thing or the other, depending on a condition.

if x > 0:
    pass
else:
    pass
Example
for x in [-90, -30, 30, 90]:
    penup()
    goto(x, 0)
    if x > 0:
        dot(30, "red")
    else:
        dot(30, "blue")
hideturtle()
What it draws
Red when x > 0, else blue

int

Turn text made of digits, such as "12", into a whole number you can calculate with.

int(text)