M99 P10; branches to line N10. It does not return control to the calling subrou-
tine. With macros enabled, M99 can be used with a conditional expression to
branch conditionally. To branch when variable #100 is less than 10 we could
code the above line as follows: N50 [#100 LT 10] M99 P10;
In this case, the branch occurs only when #100 is less than 10, otherwise
processing continues with the next program line in sequence. In the above, the
conditional M99 can be replaced with N50 IF [#100 LT 10] GOTO10;
Arithmetic Expressions
An arithmetic expression is any expression using variables, operators, or func-
tions. An arithmetic expression returns a value. Arithmetic expressions are usu-
ally used in assignment statements, but are not restricted to them.
Examples of Arithmetic expressions:
#101=#145*#30;
#1=#1+1;
X[#105+COS[#101]];
#[#2000+#13]=0;
Assignment Statements
Assignment statements allow the programmer to modify variables. The format
of the assignment statement is:
<expression>=<expression>
The expression on the left of the equal sign must always refer to a macro vari-
able, whether directly or indirectly. The following macro initializes a sequence
of variables to any value. Here both direct and indirect assignments are used.
O0300 (Initialize an array of variables) ;
N1 IF [#2 NE #0] GOTO2 (B=base variable) ;
#3000=1 (Base variable not given) ;
N2 IF [#19 NE #0] GOTO3 (S=size of array);
#3000=2 (Size of array not given) ;
N3 WHILE [#19 GT 0] DO1 ;
#19=#19-1 (Decrement count) ;
#[#2+#19]=#22 (V=value to set array to) ;
END1 ;
M99 ;
The above macro could be used to initialize three sets of variables as follows:
G65 P300 B101. S20 (INIT 101..120 TO #0) ;
G65 P300 B501. S5 V1 (INIT 501..505 TO 1.0) ;
G65 P300 B550. S5 V0 (INIT 550..554 TO 0.0) ;
The decimal point in B101., etc. would be required.