6 jumps, 7 functions and the call stack, Jumps -27 – ElmoMC SimplIQ Software Manual User Manual

Page 56: Functions and the call stack -27

Advertising
background image

SimplIQ

Software Manual

4BThe

SimplIQ

User Programming Language

MAN-SIMSW (Ver. 1.4)

5-27

global int vec[]

Redeclare

global

variable

vec

. Notice that its

dimension is omitted during redeclaration
and that its actual dimension is 10, as defined
above.

5.8.6

Jumps

Syntax:
goto ##LABEL1

The goto command instructs the program to continue its execution at the label specified by
the jump command. It may be specified only for destinations within the present function
scope and is illegal if used in a for loop or switch-case block. Jumps to labels within other
functions are not possible. Jumps to a global label from within a function are illegal.

Example:
… Working

code.

if (PX>1000)

Condition for jump.

goto##LABEL1;

Go

to

LABEL1

if condition is true.

else

Return axis to origin.

goto##LABEL2;

Go

to

LABEL2

if condition is false.

end

… Working

code.

##LABEL1;

Declare

LABEL1

.

… Working

code.

##LABEL2;

Declare

LABEL2

.

… Working

code.

5.8.7

Functions and the Call Stack

A function is a piece of code that may be called from anywhere in the program. After the
function is executed, the program resumes from the line just after the function call.

Example:

function JustSo;

Function

prototype.

JV=1000

JustSo()

Function

call.

BG

function JustSo

Function

definition

IA[1]=1;

Function

body.

return

Function

end.

Advertising