6 built-in function calls, 7 user function calls – ElmoMC SimplIQ Software Manual User Manual

Page 39

Advertising
background image

SimplIQ

Software Manual

4BThe

SimplIQ

User Programming Language

MAN-SIMSW (Ver. 1.4)

5-10

Examples:

a = AC

This expression assigns a value of the system command AC to the variable a. It
is valid if the AC command is allowed to “get a value”; that is, it has a
PreProcess flag.

AC = a

This expression assigns a value of the variable a to the system command AC. It
is valid if the AC command is allowed to “set a value”; that is, it has a
PostProcess flag.

BG

This is an executable command. It cannot be assigned; that is, it has no
PreProcess, PostProcess or Assign flag. For example, the expressions BG = 1 and
a = BG

are illegal.

LS

This expression is illegal because it uses a command that has a NotProgram flag.
Such commands are not allowed in a user program, although they are available
for use in the Interpreter language.

5.4.8.6 Built-in Function Calls

The description and syntax is the same as for the Interpreter language (refer to

section

4.2.6.4

).

5.4.8.7 User Function Calls

Functions perform a pre-written and compiled code. They get a list of arguments from their
caller and return a list of return values. Functions get their list of input arguments by value;
they do not modify them directly. The general syntax of a function call is:
[OUT1,OUT2,…OUTN]=FUNC(IN1,IN2,…IN_N)

If only one value is returned, brackets are not required and the syntax is as follows:
OUT=FUNC(IN_1,…,IN_N)

Not all output variables must be assigned. For example, if the function FUNC returns two
values, then
[IA[1],IA[2]]=FUNC()

assigns the two returned values to IA[1] and IA[2].

IA[1]=FUNC()

returns the first return value to IA[1] and the other returned values remain

unused. If the returned value type differs from the returned variable type, the result is a
type cast to the type of the variable.

The number of input arguments during a function call is strictly according to its definition.

If a function call is part of an expression, then multiple output of the function is illegal. For
example:
[a, b] = 5 + func(c)

and
[a, b] = func(c) + 5

are both illegal because a function call is part of an expression and must be evaluated in a
single value (refer to

section

5.4.8.7

).

Advertising