beautypg.com

1 labels (entry points) and subroutines, Labels (entry points) and subroutines -13 – ElmoMC SimplIQ Software Manual User Manual

Page 42

background image

SimplIQ

Software Manual

4BThe

SimplIQ

User Programming Language

MAN-SIMSW (Ver. 1.4)

5-13

if - elseif - else - end Conditional

expression.

switch-case-otherwise-end Case

selection.

goto

Go to a certain point in the program.

reset

Kill the state of the executing program and jump to a certain
point in the program.

function-return

Declare a function and its return point.

##

Declare a label or an auto-routine.

#@

Declare a label or an auto-routine.

#@ - return

Declare an auto-routine and its return point.

exit Terminate

program

execution.

continue

Transfers control to next iteration of smallest enclosing for or
while loop in which it appears.

try-catch

Used to react to an expected fault.

5.7.1

Labels (Entry Points) and Subroutines

Labels denote that program execution can start from that location, or that program
execution can be branched to that location.

Label definition has the following syntax:
##
or
#@

A maximum of 12 characters — letters and/or digits (not leading) and underscore (not
leading) only — may be used for a label. The label name must be unique.

Labels can reside inside or outside function bodies, but not within a program flow structure,
such as a for iteration. Labels inside function bodies are regarded as local to the function
and serve as targets for goto instructions with the same function. Labels in the global text
scope serve as possible execution starting points, and also as targets for reset and global
scope goto.

A subroutine is a global label in which the body ends with a return keyword. A subroutine
is similar to a function without input and output arguments. It can be called from any place
in the program and may serve as a target for a reset instruction.

An auto-routine is a subroutine whose return keyword is an instruction to return to the next
line in the code, from where the subroutine was called.

DummyLabel is a keyword used internally by the Compiler. It is not a legal label or

subroutine name.

The XQ and the XC program launch commands use labels to specify where to start program
execution and where to terminate. For example, the command XQ ##LOOP2 is used to
begin execution at ##LOOP2.