\section{NARGOUT Number of Output Arguments}

\subsection{Usage}

The special variable \verb|nargout| is defined inside of all
functions.  It indicates how many return values were requested from
the function when it was called.  FreeMat allows for
fewer return values to be requested from a function than were declared,
and \verb|nargout| can be used to determine exactly what subset of 
the functions outputs are required.  There is no syntax for 
the use of \verb|nargout| - it is automatically defined inside 
the function body.
\subsection{Example}

Here is a function that is declared to return five 
values, and that simply prints the value of \verb|nargout|
each time it is called.
\begin{verbatim}
    nargouttest.m
function [a1,a2,a3,a4,a5] = nargouttest
  printf('nargout = %d\n',nargout);
  a1 = 1; a2 = 2; a3 = 3; a4 = 4; a5 = 5;
\end{verbatim}
\begin{verbatim}
--> a1 = nargouttest
nargout = 1
a1 = 
  <int32>  - size: [1 1]
 1  
--> [a1,a2] = nargouttest
nargout = 2
a1 = 
  <int32>  - size: [1 1]
 1  
a2 = 
  <int32>  - size: [1 1]
 2  
--> [a1,a2,a3] = nargouttest
nargout = 3
a1 = 
  <int32>  - size: [1 1]
 1  
a2 = 
  <int32>  - size: [1 1]
 2  
a3 = 
  <int32>  - size: [1 1]
 3  
--> [a1,a2,a3,a4,a5] = nargouttest
nargout = 5
a1 = 
  <int32>  - size: [1 1]
 1  
a2 = 
  <int32>  - size: [1 1]
 2  
a3 = 
  <int32>  - size: [1 1]
 3  
a4 = 
  <int32>  - size: [1 1]
 4  
a5 = 
  <int32>  - size: [1 1]
 5  

\end{verbatim}
