The opposite of Inc, the function Dec decrements an integer value by 1, and provides faster and cleaner processing than using a statement like Eyes := Eyes - 1.

Unless of course you were wanting to decrease the variable Eyes by a greater number such as 10, when you would use Eyes := Eyes - 10.

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

Examples as below.

procedure OnMapEvent(var Value:Variant);
var
Eyes : integer;
begin // loop while Eyes > 10
Eyes := 20;
while Eyes > 10 do
begin
LogInfo('Eyes is equal to '+IntToStr(Eyes));
Dec(Eyes);
end;
end;

This example writes a decreasing sequence of entries to the log, starting with Eyes is equal to 20, and ending with Eyes is equal to 11.

image-20240115-000227.png