1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
<?xml version="1.0" encoding="UTF-8"?>
<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="select">
<info>
<pubdate>$LastChangedDate$</pubdate>
</info>
<refnamediv>
<refname>select</refname>
<refpurpose> select keyword</refpurpose>
</refnamediv>
<refsection>
<title>Description</title>
<programlisting role = ""><![CDATA[
select expr,
case expr1 then instructions1,
case expr2 then instructions2,
...
case exprn then instructionsn,
[else instructions],
end
]]></programlisting>
<para>
</para>
<para>
Notes:
</para>
<itemizedlist>
<listitem>
<para>The only constraint is that each "then" keyword must be on the same line line as corresponding "case" keyword.</para>
</listitem>
<listitem>
<para>The keyword "then" can be replaced by a carriage return or a comma. <literal>instructions1</literal> are executed if <literal>expr1=expr</literal>, etc.</para>
</listitem>
</itemizedlist>
<para>
Warning: the number of characters used to define the body of any
conditionnal instruction (if while for or select/case) must be limited to
16k.</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
while %t do
n=round(10*rand(1,1))
select n
case 0 then
disp(0)
case 1 then
disp(1)
else
break
end
end
]]></programlisting>
</refsection>
<refsection>
<title>See Also</title>
<simplelist type="inline">
<member>
<link linkend="if">if</link>
</member>
<member>
<link linkend="while">while</link>
</member>
<member>
<link linkend="for">for</link>
</member>
</simplelist>
</refsection>
</refentry>
|