32 lines
603 B
Plaintext
32 lines
603 B
Plaintext
![]() |
\b;Instruction \c;return\n;
|
||
|
Returns from a function. Syntax:
|
||
|
\c;
|
||
|
\s;void function ( )
|
||
|
\s;{
|
||
|
\s; return;
|
||
|
\s;}
|
||
|
\n;
|
||
|
\b;For specialists
|
||
|
If the \l;function\u cbot\function; has a return type, the \c;return\n; instruction must be followed by the value to be returned:
|
||
|
\c;
|
||
|
\s;float Pi ( )
|
||
|
\s;{
|
||
|
\s; return 3.1415;
|
||
|
\s;}
|
||
|
|
||
|
\s;float Mean (float a, float b)
|
||
|
\s;{
|
||
|
\s; return (a+b)/2;
|
||
|
\s;}
|
||
|
|
||
|
\s;string Sign (float a)
|
||
|
\s;{
|
||
|
\s; if ( a > 0 ) return "positive";
|
||
|
\s; if ( a < 0 ) return "négative";
|
||
|
\s; return "null";
|
||
|
\s;}
|
||
|
\n;
|
||
|
\t;See also
|
||
|
\l;Programming\u cbot;, \l;types\u cbot\type; and \l;categories\u cbot\category;.
|
||
|
|