loops/quickref.tex
author Puneeth Chaganti <punchagan@fossee.in>
Tue, 19 Oct 2010 14:26:29 +0530
changeset 338 e4a7d0924143
parent 285 7c4855fb8e5f
permissions -rw-r--r--
Reviewed Least Square Fit LO.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
285
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     1
\textbf{loops}
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     2
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     3
To iterate over a sequence: \lstinline|for i in sequence:|\\
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     4
\texttt{i} is the looping variable. 
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     5
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     6
To iterate while a condition is true: \lstinline|while condition:|
217
b595f90016c5 Changed structure of my scripts.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
285
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     8
Blocks in python are indented. To end block return to the previous
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
     9
indentation. 
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    10
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    11
To break out of the innermost loop: \lstinline|break|
217
b595f90016c5 Changed structure of my scripts.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
285
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    13
To skip to end of current iteration: \lstinline|continue|
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    14
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    15
\lstinline|pass| is just a syntactic filler. 
7c4855fb8e5f Quickrefs
Puneeth Chaganti <punchagan@fossee.in>
parents: 217
diff changeset
    16