## NARGIN Number of Input Arguments

Section: Functions and Scripts

### Usage

The special variable `nargin` is defined inside of all functions. It indicates how many arguments were passed to the function when it was called. FreeMat allows for fewer arguments to be passed to a function than were declared, and `nargin`, along with `isset` can be used to determine exactly what subset of the arguments were defined. There is no syntax for the use of `nargin` - it is automatically defined inside the function body.

### Example

Here is a function that is declared to take five arguments, and that simply prints the value of `nargin` each time it is called.

         nargintest.m
    function nargintest(a1,a2,a3,a4,a5)
      printf('nargin = %d\n',nargin);

    --> nargintest(3);
    nargin = 1
    --> nargintest(3,'h');
    nargin = 2
    --> nargintest(3,'h',1.34);
    nargin = 3
    --> nargintest(3,'h',1.34,pi,e);
    nargin = 5