next up previous
Next: The begin-end Construct Up: Pseudocode: A LATEX Style Previous: Introduction

The pseudocode Environment

Within the pseudocode environment, a number of commands for popular algorithmic constructs are available. In general, the commands provided can be nested to describe quite complex algorithms.

The pseudocode environment is invoked as follows:

\begin{pseudocode}{<Name>}{<Parameters>}
  pseudocode constructs
\end{pseudocode}

The argument <Name> is the name of the algorithm, and <Parameters> is a list of parameters for the algorithm. For example, the commands

\begin{pseudocode}{CelsiusToFahrenheit}{c}
  f \GETS {9c/5} + 32\\
  \RETURN{f}
\end{pseudocode}

produce the following output when included in a LATEX document:


\begin{pseudocode}{CelsiusToFahrenheit}{c}
f \GETS {9c/5} + 32\\
\RETURN{f}
\end{pseudocode}

Notice that the command \GETS produces a left arrow, which we use to indicate an assignment of a variable. The user could use instead some other symbol, if desired. For example, \GETS could be replaced by =, as is done in the ``C'' programming language.



 

Donald L. Kreher
2000-02-18