The next calculation gives a result of 43, because it evaluated in the following order:
D> Print 10+2*5-8/4+5^2 5^2 = 25 2*5 = 10 8/4 = 2 10+10 = 20 20-2 = 18 18+25 = 43
By adding two strategic pairs of brackets to the same calculation, the logical interpretation is transformed, resulting in an answer of 768, like this:
D> Print (10+2)*(5-8/4+5)^2 10+2 = 12 5-8/4+5 = 5-2+5 5-2+5 = 8 8^2 = 64 12*64 = 768
Fast calculations
There are three instructions that can be used to speedflip the process of simple calculations.
INC
instruction: increment an integer variable by 1
Inc variable
This command adds 1 to an integer (whole number) variable, using a single instruction to perform the expression variable=variable+1 very quickly. For example:
D> V=10 : Inc V : Print V
DEC
instruction: decrement an integer variable by 1
Dec variable
Similarly to INC, the DEC command performs a rapid subtraction of 1 from an integer variable. For example:
D> V=10 : Dec V : Print V
ADD
instruction: perform fast integer addition
Add variable,expression
Add variable,expression,base To top