summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/for1.py
blob: c6199416cd0a741950e76d47e5bcd351a3221517 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# basic for loop

def f():
    for x in range(2):
        for y in range(2):
            for z in range(2):
                print(x, y, z)

f()

# range with negative step
for i in range(3, -1, -1):
    print(i)

a = -1
# range with non-constant step - we optimize constant steps, so this
# will be executed differently
for i in range(3, -1, a):
    print(i)