fix trouble in help generation
[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" xmlns:scilab="http://www.scilab.org" 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>Syntax</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 (<varname>rhs</varname>)
19             and output arguments (<varname>lhs</varname>) 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         <para>
24             <note>
25                 Note that <varname>lhs</varname> is always greater than or equal to 1. That is to say, even if a function
26                 is called without having mentioned an output argument, <varname>lhs</varname> will be equal to 1.
27             </note>
28         </para>
29     </refsection>
30     <refsection>
31         <title>Examples</title>
32         <programlisting role="example"><![CDATA[
33 function concat=myOwnFunction(name,optional)
34   [lhs,rhs]=argn(0);
35   disp(lhs);
36   if rhs <= 1 then
37          optional="my Optional value";
38   end
39   if rhs == 0 then
40          error("Expect at least one argument");
41   end
42   concat=name+" "+optional;
43 endfunction
44  ]]></programlisting>
45     </refsection>
46     <refsection role="see also">
47         <title>See also</title>
48         <simplelist type="inline">
49             <member>
50                 <link linkend="function">function</link>
51             </member>
52             <member>
53                 <link linkend="varargin">varargin</link>
54             </member>
55         </simplelist>
56     </refsection>
57 </refentry>