8 continue, Continue -19 – ElmoMC SimplIQ Software Manual User Manual

Page 48

Advertising
background image

SimplIQ

Software Manual

4BThe

SimplIQ

User Programming Language

MAN-SIMSW (Ver. 1.4)

5-19

Example:
The following example selects the size of a point-to-point motion according to the value of
variable k.
int k

Variable

declaration


switch (k)

For

example,

k=2

case 1

PA=1000;

case2

PA=2000;

This statement will be performed.

otherwise

PA=500;

If

k

does not equal 1 or 2, PA=500.

end

5.7.8

Continue

The continue keyword transfers control to the next iteration of the smallest enclosing for or
while loop in which it appears. It thereby enables a jump from the current position to the
beginning of the for and while loop, without executing statements through the end of the
loop.

A continue keyword outside a for or while loop is illegal.
The continue keyword may appear inside an if-else or a switch block.
A continue keyword within a try-catch block is not allowed unless a for or while loop is
completely enclosed within the try-catch block.

Example 1:
. . .
for k=1:5

if arr[k] == 0

continue

end
. . .
end

In this example, the continue keyword is within an if block. If the condition arr[k] == 0
is true, it jumps to the beginning of the for loop.

Advertising