* Categories have been created for the following modules help pages:
[scilab.git] / scilab / modules / functions / help / en_US / argn.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="argn">
3   <refnamediv>
4     <refname>argn</refname>
5     <refpurpose> Returns the number of input/output arguments in a function call</refpurpose>
6   </refnamediv>
7   <refsynopsisdiv>
8     <title>Calling Sequence</title>
9     <synopsis>[lhs [,rhs] ]=argn()
10       lhs=argn(1)
11       rhs=argn(2)
12     </synopsis>
13   </refsynopsisdiv>
14   <refsection>
15     <title>Description</title>
16     <para>
17       This function is used inside a function definition.
18       It gives the number of actual inputs arguments (<literal>rhs</literal>)
19       and output arguments (<literal>lhs</literal>) passed to the function when the function is 
20       called. It is usually used in function definitions to deal with 
21       optional arguments.
22     </para>
23   </refsection>
24   <refsection>
25     <title>Examples</title>
26     <programlisting role="example"><![CDATA[ 
27 function concat=myOwnFunction(name,optional)
28   [lhs,rhs]=argn(0) 
29   if rhs <= 1 then
30          optional="my Optional value"
31   end
32   if rhs == 0 then
33          error("Expect at least one argument")
34   end
35   concat=name+" "+optional
36 endfunction
37  ]]></programlisting>
38   </refsection>
39   <refsection role="see also">
40     <title>See Also</title>
41     <simplelist type="inline">
42       <member>
43         <link linkend="function">function</link>
44       </member>
45       <member>
46         <link linkend="varargin">varargin</link>
47       </member>
48     </simplelist>
49   </refsection>
50 </refentry>