| [Overview][Constants][Types][Classes][Procedures and functions][Variables] |
Decrease value of variable
Source position: line 0
procedure Dec( |
var X: TOrdinal |
); |
var X: TOrdinal; |
Decrement: TOrdinal |
); |
Dec decreases the value of X with Decrement. If Decrement isn't specified, then 1 is taken as a default.
A range check can occur, or an underflow error, if an attempt it made to decrease X below its minimum value.
|
Increase value of integer variable |
Program Example14; { Program to demonstrate the Dec function. } Var I : Integer; L : Longint; W : Word; B : Byte; Si : ShortInt; begin I:=1; L:=2; W:=3; B:=4; Si:=5; Dec (i); { i:=0 } Dec (L,2); { L:=0 } Dec (W,2); { W:=1 } Dec (B,-2); { B:=6 } Dec (Si,0); { Si:=5 } end.
It appears that FreePascal (as at least of version 2.04) allows to apply Dec / Inc on elements of type PChar (to be used carefully, as it is not a recommanded practice).
---------------
+ Summary manual of Gnat, an Ada compiler
+ ANSI_Console, an Ada package for console applications using ANSI/ECMA terminal commands
-- Yannick DuchĂȘne on May 15, 2007 03:15 AM (view details)