Loops

for Statement
For loops are used to iterate an iterable. They are most often used to execute code n about of times.

Output: 1 2 3

For..Else
Code block after else is executed after after the for, but only if loop is terminates in standard way (brake statement is not used)

Output: 1 2 3 after for

while Statement
While loop, like for, is used for executing code many times. Main difference between those two is fact that while loop isn't executed n times, but until a defined condition is false.

Loop control statements
Loop control statements change standard loop execution flow.

Execution of this loop is stopped do_something returns False

break
Break terminates the current loop and resume next statement execution.

Output: 1 test

continue
Continue stops execution of current iteration and moves the control back to the top of next iteration.

Output: 1 3 test

pass
Pass statement is a *null* operator in Python. Nothing happen when it executes. It's placeholder used when statement is required by syntax, but no code is needed to be executed.

Output: (empty output)