Changes to conditionals quickref.
authorPuneeth Chaganti <punchagan@fossee.in>
Wed, 10 Nov 2010 13:30:25 +0530
changeset 439 b437ff7def95
parent 438 4523b2048663
child 440 b2e8522839f0
Changes to conditionals quickref.
conditionals/quickref.tex
--- a/conditionals/quickref.tex	Wed Nov 10 13:25:46 2010 +0530
+++ b/conditionals/quickref.tex	Wed Nov 10 13:30:25 2010 +0530
@@ -1,8 +1,12 @@
-Creating a linear array:\\
-{\ex \lstinline|    x = linspace(0, 2*pi, 50)|}
+Writing an if/elif/else block:
+\begin{lstlisting}
+if condition1:
+   # do A, B, C
+elif condition2:
+   # do D, E
+else:
+   # do Y, Z
+\end{lstlisting}
 
-Plotting two variables:\\
-{\ex \lstinline|    plot(x, sin(x))|}
-
-Plotting two lists of equal length x, y:\\
-{\ex \lstinline|    plot(x, y)|}
+The ternary operator:
+{\ex \lstinline|    C if X else Y|} -- Do C if X is True else do Y.