Next: , Previous: , Up: Imperative Statements   [Contents][Index]


10.4.4.3 call

call          ::= identifier "(" argument-list ")"
argument-list ::= (expression ",")*

For example:

foo ();
bar (true, 12);

Note that the value returned by a call to a non-void function is not allowed to be ignored. Therefore in the example above both foo and bar must be functions of type void. By capturing the value in a variable definition or the use of an assign to an existing variable is the proper way to handle the return value:

bool b = bool_function ();
b = bool_function ();

Another way is to properly use a return value is in simple expressions, possibly combined with: ==, !=, !, &&, || (since 2.14.0)

if (bool_function ()) …;
if (!bool_function ()) …;
if (!bool_function () && b) …;
if (enum_function () == result.FALSE) …;
if (enum_function () != result.TRUE || b) …;
reply (enum_function ());
reply (enum_function () != result.ERROR);

or in any expression (since 2.16.0).