loops/quickref.tex
changeset 324 4054b1a6392d
parent 285 7c4855fb8e5f
--- a/loops/quickref.tex	Wed Oct 13 17:32:23 2010 +0530
+++ b/loops/quickref.tex	Wed Oct 13 17:32:59 2010 +0530
@@ -1,8 +1,16 @@
-Creating a linear array:\\
-{\ex \lstinline|    x = linspace(0, 2*pi, 50)|}
+\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:|
 
-Plotting two variables:\\
-{\ex \lstinline|    plot(x, sin(x))|}
+Blocks in python are indented. To end block return to the previous
+indentation. 
+
+To break out of the innermost loop: \lstinline|break|
 
-Plotting two lists of equal length x, y:\\
-{\ex \lstinline|    plot(x, y)|}
+To skip to end of current iteration: \lstinline|continue|
+
+\lstinline|pass| is just a syntactic filler. 
+