Code blocks

A code block is one or more lines of Python code, which are all indented. Here are some things you can do with code blocks:

Give them a name (by making them into a function)

def greeting(name):
    print("Hello, friend.")
    print("I remember you--your name is " + name)

Make them happen over and over

for side in range(4):
    forward(100)
    right(90)

Decide whether they happen at all

for number in range(100):
    if number < 50:
        forward(number)
        right(90)

In each case, the code block is introduced by a line which ends in a colon and the code block is indented.