7.2.2 While-do (Prechecking)

Now let us consider the next control structure:


\begin{algorithmic}
\WHILE{condition}
\STATE while-block
\ENDWHILE
\end{algorithmic}

This translates to the following ugly code:


\begin{algorithmic}
\STATE checkPrecondition:
\IF{not condition}
\STATE goto ...
... while-block
\STATE goto checkPrecondition
\STATE exitLoop:
\end{algorithmic}



Copyright © 2009-04-16 by Tak Auyeung