Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 833 Bytes

if_statement.md

File metadata and controls

23 lines (15 loc) · 833 Bytes

if-Statement

If-statements check whether a statement meets a certain condition, and are used to write code that "makes decisions". They start with if followed by a condition which is evaluated to be either true or false. If it's true, the block after the colon (:) is run. If it's false, the block under the else: is run.

weather = "sunny"

if weather == "sunny":
    print("Bring your shades")
elif weather == "rainy":
	print("Bring your umbrella")
else:
    print("I don't know what you should bring! I'm just a little program...")

Readings

Tutorials