<filename>book/chapter3/chapter3.tex
\chapter{Selection Statements}

Oftentimes, programs will need to perform different actions in different
scenarios.  For instance, a program might need to test input to see if
it is erroneous, or check which menu option a user selected.  Many
algorithms also rely on checking conditions to achieve their results.

If we continue the programs as recipes metaphor, we can consider recipes
that call for different baking temperatures depending on whether the pan
you are using is metal or glass, or even depending on whether you live in
a high altitude area.

In this chapter, we will learn how to write programs to test for conditions
and do different things based on whether they have occurred or not.

\section{If statements}

Tetra uses the keyword \texttt{if} to check if a condition has occurred.
For instance, if we want the user to enter a positive number, we can use
an \texttt{if} statement for this purpose:

\def \codelabel {ch3if1}
\def \codecaption{Using if to check input}
\input{chapter3/if1.ttr.tex}

The output of this program can be seen below:

\input{chapter3/if1.ttr.out}



\section{Conditions}


\section{Boolean Variables}


\section{Boolean Expressions}

\section{Else Statements}



\section{Elif Statements}


\section{Summary}


\section{Exercises}

