Dec

From Soldat Community Wiki
Jump to: navigation, search
procedure dec(var X: integer; N: integer);

Parameter Info:
variable X (Integer): Numeric variable to decrease by N (see below)
N (Integer): Number to decrement X by.

Description:
This function will decrement (decrease) the value of an integer by whatever number you specify in the  N field. See below for an example:

Examples

var
MyNumber: integer;
begin
    MyNumber := 20;
    WriteLn(inttostr(MyNumber)); // 20
    dec(MyNumber,5);
    WriteLn(inttostr(MyNumber)); // 15
    dec(MyNumber,10);
    WriteLn(inttostr(MyNumber)); // 5
    dec(MyNumber,4);
    WriteLn(inttostr(MyNumber)); // 1
end;


External Links