summaryrefslogtreecommitdiff
path: root/loops/quickref.tex
blob: e0b8d61ca8ae341fbc6db5d8a0321b7180c677f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
\textbf{loops}

To iterate over a sequence: \lstinline|for i in sequence:|\\
\texttt{i} is the looping variable. 

To iterate while a condition is true: \lstinline|while condition:|

Blocks in python are indented. To end block return to the previous
indentation. 

To break out of the innermost loop: \lstinline|break|

To skip to end of current iteration: \lstinline|continue|

\lstinline|pass| is just a syntactic filler.