Зменшити значення змінної на одиницю.

 

Синтаксис

procedure Dec(var x);

 

Параметри та значення, що повертаються

Параметр

Тип

Значення

x

число або тип, що перераховується

значення, яке потрібно зменшити на 1.

 

Результат функції

Змінна параметр зменшує своє значення на 1.

 

Приклад
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.


Результат роботи скрипту

[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
 

Дивитися ще

mLogScript