loops/quickref.tex
author Anoop Jacob Thomas<anoop@fossee.in>
Sun, 07 Nov 2010 18:36:59 +0530
changeset 398 36295bb91766
parent 285 7c4855fb8e5f
permissions -rw-r--r--
Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
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