Increment

From AGI Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

The increment command increases a variable's value by one.

Syntax

increment(var vA);
++vA;
vA++;
vA = vA + 1;
vA += 1;

Remarks

Unlike the addn command, the increment command does not wrap around. If the value of vA is already 255, executing the increment command has no effect; the value will remain at 255.

When using the alternate syntax vA = vA + 1; WinAGI will compile an increment command. If you specifically want to use the addn command, you must use the full command syntax (addn(vA, 1);).

Possible Errors

None.

Example

Code:
v50 = 254;
increment(v50); [ v50 now equals 255
++v50;          [ v50 still equals 255
v50 = v50 + 1;  [ WinAGI compiles this as an increment command, so v50 still equals 255
addn(v50, 1);   [ now v50 = 0

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 1 (0x01 hex)

See Also

Mathematical Commands
decrement
addn