## NARGIN Number of Input Arguments

Section: Functions and Scripts

### Usage

The `nargin` function returns the number of arguments passed to a function when it was called. The general syntax for its use is

      y = nargin

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.

### 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