This is an old revision of the document!
10LC's If
statement supports the same level of complexity (and ugliness) that you can generate using the 9010A directly. This means that you can build very expressive, yet possibly very ugly, expressions. Here is an example program that demonstrates several If
expressions with varying levels of complexity (and ugliness).
Note that 10LC does not currently know how to optimize constant If
expressions at compile time. For example, in the first If
expression below, 44 ++ » »
is a constant expression that evaluates to 11
and JoystickUp « « | 44
is also a constant expression that evaluates to 44
. That means that the entire expression could be optimized to If 11 ⇐ 44 Goto BreakOut;
which would save 7 bytes of code.
Program IfTest; Const JoystickUp = 0x01; Alias Value2=Reg2; Display "This is a test#"; If 44 ++ >> >> <= JoystickUp << << | 44 Goto BreakOut; // If 11 <= 44 If 0x23 <= JoystickUp | RegF Goto BreakOut; // If 35 <= ( 1 OR RegF ) IF 1 == 3 Goto BreakOut; IF REG0 >= 11 Goto BreakOut; IF REGA == REG2 Goto BreakOut; IF ~REG0 == REG5 >> 2 Goto BreakOut; IF REG1 >> 2 >= REGA ~ ~ >> ~ << Goto BreakOut; IF ~45 ++ << > 56 ++ << ~ Goto BreakOut; If REGA & Value2 ++ <= JoystickUp | RegF << 4 Goto BreakOut; :BreakOut Display "Test Over";