B.3.6 if-else sample, B.3.7 if-else-if sample, B.3.8 label and goto sample – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 263: B.3.9 order of processing sample

Advertising
background image

B.3.6

If-Else Sample

function run()
int a, b
a=7
b=10

if (a < b+5)

a=a+2

else

b=b-2

end

if

end function

B.3.7

If-Else-If Sample

function run()

int a, b , c

b=4
c=11

if ((b == 4)&&(c == 18))

a=1

// b is 4; c is 18

else if ((b == 4)&&(c == 11))

a=2

// b is 4; c is 11

else

a=7

// any other cases

end

if

end function

B.3.8

Label and GoTo Sample

function run()

int i, j


for i = 0 : 2 : 20

for j = 2 : 16

if( i > j+10)

goto ##label

end if

end for

end for


##label
i=0
end function

B.3.9

Order of Processing Sample

function run()

int a , b , c, res1, res2, res3

a = 2

b = 4

c

=

9

res1 = a + b * c

res2 = a + (b * c)

res3 = (a + b) * c

end function

//The output from the following code is:

//

res1 = 38

//

res2 = 38

//

res3 = 54

Maestro

Software Manual

Appendix B: Sample Programs

MAN-MASSW (Ver. Q)

B-11

Advertising