Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

if statement again

  • if
  • ==
x = 2

if x == 2:
    print("it is 2")
else:
    print("it is NOT 2")


if x == 3:
    print("it is 3")
else:
    print("it is NOT 3")

# it is 2
# it is NOT 3