01-Use of the if else statement.py

Sign up Free. Don't forget to check out our challenges, lessons, solve and learn series and more ...

Code Snippet

"""Note the syntax of an if else statement. Don't forget the : at the end.
x = 'boo'
if x == 'boo':
    print ('Eek')
    print ('Anyone there?')

"""It is very important that you note the indentation (spacing out) of this code.
The if and else are on the same indentation level. The print is indented inside the if....

Try it yourself