mathsoftware

A course about LaTeX and SageMath
git clone https://git.tronto.net/mathsoftware
Download | Log | Files | Refs | README | LICENSE

6-PythonIntroduction.vrb (1343B)


      1 \frametitle{\texttt {while} loop}
      2 \begin{columns}
      3     \column{0.45\textwidth}
      4       \texttt{{\bf while} \emph{condition}:}
      5 
      6       \texttt{\qquad instruction1}
      7 
      8       \texttt{\qquad instruction2}
      9 
     10       \texttt{\qquad \dots}
     11     \column{0.55\textwidth}
     12       \begin{tikzpicture}
     13         \tikzstyle{s} = [rectangle, rounded corners, text centered,
     14                                                        draw=black, fill=red!30]
     15         \tikzstyle{p} = [rectangle, text centered, draw=black, fill=orange!30]
     16         \tikzstyle{d} = [rectangle, text centered, draw=black, fill=green!30]
     17 
     18         \node(start)  [s]                     {Start};
     19         \node(cond)   [d, below of=start]     {\texttt{\emph{condition}}?};
     20         \node(inst1)  [p, right of=cond, xshift=2.7cm] {\texttt{instruction1}};
     21         \node(inst2)  [p, below of=inst1]     {\texttt{instruction2}};
     22         \node(dots)   [p, below of=inst2]     {\texttt{\dots}};
     23         \node(end)    [s, below of=other, yshift=-0.5cm] {End};
     24 
     25         \draw[->] (start) -- (cond);
     26         \draw[->] (cond) -- node[anchor=south] {\texttt{True}} (inst1);
     27         \draw[->] (inst1) -- (inst2);
     28         \draw[->] (inst2) -- (dots);
     29         \draw[->] (cond) -- node[anchor=east] {\texttt{False}} (end);
     30         \draw[->] (dots) -| ($(cond.south)+(0.4,0)$);
     31       \end{tikzpicture}
     32   \end{columns}