# nargin, nargout

There are two special identifiers, nargin and nargout, that indicate the number of parameters passed into and the number of parameters returned from the function respectively.

They can be used inside a function body, as shown below.

```
function [x,y] = goo(a,b,c)
print(nargin)
print(nargout)
x=a+b
y=b+c
end
```

They can also be used outside, for example:

```
function [y1, y2, y3] = foo(x1, x2)
y1=x1;
y2=x2;
y3=x1+x2;
end
nargin('foo')
nargout('foo')
```

This will return 2 and 3.

In case the function take advantage of the ability to pass (or get) variable numbers of input (or output) to a function, nargin and nargout return negative values. For example :

```
function [y1, y2, varargout] = goo(x1, varargin)
y1=x1;
y2=x2;
y3=x1+x2;
end
nargin('goo')
nargout('goo')
```

This will return -2 and -3.