MyChat Scripts Engine: Dec
Decreasing a variable value by 1.
Syntax
procedure Dec(var x);
Parameters and return values
Parameter |
Type |
Value |
x |
number or enumerated type |
value that you need to decrease by 1. |
Function result
Variable decreases its value by 1.
Example
type
TSuit = (Hearts, Clubs, Diamonds, Spades);
var
i: integer;
card: TSuit;
function GetCardSuit(card: TSuit): string;
begin
if Card = Hearts then result := 'Hearts'
else if Card = Clubs then result := 'Clubs'
else if Card = Diamonds then result := 'Diamonds'
else result := 'Spades';
end;
begin
card := Clubs;
mLogScript('Card starts at: ' + GetCardSuit(card), '');
for i := 1 to 2 do begin
Inc(card);
mLogScript('Card suit is: ' + GetCardSuit(card), '');
end;
end.
Script work result
[07:43:50] (Log "Inc"): Card starts at: Clubs
[07:43:50] (Log "Inc"): Card suit is: Diamonds
[07:43:50] (Log "Inc"): Card suit is: Spades
See also
Created with the Personal Edition of HelpNDoc: Effortlessly Convert Your Word Doc to an eBook: A Step-by-Step Guide