1 the maxl break statement, 2 the maxl continue statement, 3 the maxl return statement – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 91: 4 the goto statement

Advertising
background image

break
continue
return

goto identifier

5.5.4.1

5.5.4.2

5.5.4.3

5.5.4.4

Maestro

Software Manual

MAXL Program Language

MAN-MASSW (Ver. Q)

The MAXL break Statement

The break statement is used to exit an iteration statement. It transfers control to the
statement immediately following the iteration statement.

The break statement terminates only the most tightly enclosing loop. In loops, break
is used to terminate before the termination criteria evaluate to 0.

Syntax

break

The following example illustrates the use of the break statement in a while loop:

While(1) // No termination condition.

if( program.status() == 2) //program halt

break

end while

Note

There are other simple ways to escape a loop. It is best to use the break

statement in more complex loops, where it can be difficult to tell whether the loop
should be terminated before several statements have been executed

.

The MAXL continue Statement

The continue statement forces immediate transfer of control to the loop-continuation
statement of the smallest enclosing loop. (The “loop-continuation” is the statement
that contains the controlling expression for the loop.) Therefore, the continue
statement can appear only in the dependent statement of an iteration statement.

Syntax

continue

The MAXL return Statement

The return statement allows a function to immediately transfer control back to the
calling function. A function can have any number of return statements.

Syntax

return

The goto Statement

The goto statement performs an unconditional transfer of control to the named label.
The label must be in the current function.

Syntax

goto labeled-statement

5-29

Advertising