\section{BREAK Exit Execution In Loop}

\subsection{Usage}

The \verb|break| statement is used to exit a loop prematurely.
It can be used inside a \verb|for| loop or a \verb|while| loop.  The
syntax for its use is
\begin{verbatim}
   break
\end{verbatim}
inside the body of the loop.  The \verb|break| statement forces
execution to exit the loop immediately.
\subsection{Example}

Here is a simple example of how \verb|break| exits the loop.
We have a loop that sums integers from \verb|1| to \verb|10|, but
that stops prematurely at \verb|5| using a \verb|break|.  We will
use a \verb|while| loop.
\begin{verbatim}
    break_ex.m
function accum = break_ex
  accum = 0;
  i = 1;
  while (i<=10) 
    accum = accum + i;
    if (i == 5)
      break;
    end
    i = i + 1;
  end
\end{verbatim}
The function is exercised here:
\begin{verbatim}
--> break_ex

ans = 

 15 

--> sum(1:5)

ans = 

 15 


\end{verbatim}
