Skip to content

Inc ​

Inc provides faster and more streamlined processing to increment an integer value by 1.

It is cleaner than using a statement like Eyes := Eyes + 1, which increments the value of the variable Eyes by 1. Unless you are wanting to increment the variable by a larger number such as 10 (Eyes := Eyes + 10).

Inc is the opposite of Dec.

Declaration: Procedure Inc(var X: Integer); overload

In this example as below, the variable Eyes will get as high as 9, then exit the loop.

pascal
procedure OnMapEvent(var Value:Variant);
var
  Eyes : integer;
begin // loop while Eyes < 10
   Eyes := 0;
 while Eyes < 10 do
 begin
      LogInfo('Eyes is equal to '+IntToStr(Eyes));
      Inc(Eyes);
 end;
end;

This example writes a sequential series of entries to the log, starting with Eyes is equal to 0, and ending with Eyes is equal to 9.

image-20240114-235608.png