|
Families Conditional Display Financial Integer Mem Misc Ops Program flow Stack Stats Trig Value |
Conditional All of the conditional statements compare one value to another value. If the condition is met (true) then the next program step is skipped. If the condition is false then the next step is executed. The next step is often a "Goto" or "Gosub" command.
The "ISG" and "DSE" commands are very useful in controlling program loops. They use a value stored in a memory register to determine whether or not to skip the next step. The value can be stored in any of the memory registers (1 to 20) or in the "i" register. The value in the register must have the following 3-part structure:
NNNN.xxxyy For instance, a value of 10.04002 would be interpreted as follows:
Current value=10 Upon reaching the "ISG" command, the current value would be incremented by 2 (current value now = 12) and it would be compared with 40. It is NOT greater than 40, so the next step will NOT be skipped. The value in the register now will be 12.04002. If the increment value is undefined (= 0) then the increment value will default to 1. Example:
This program will start with a value of 10, incrementing it by 2 until the value reaches 40. "DSE": The "Decrement and skip if equal or less" command works the same as the "ISG" command, except it subtracts the increment amount, and continues until the current value is equal to or less than the target. |