do
The Do keyword is always a part of one of the 4 control types (for, while, try and with). It
precedes the Statements section of the control action.
Example
Download This Source for Free Pascal
{$MODE DELPHI} // For "Try/Except" keywords
uses
SysUtils; // Defines "exception"
type
MyStructure = Record
FirstName:String;
LastName:String;
End;
var
int:Integer;
Author:MyStructure;
begin
try
for int:=1 to 10 do Writeln(int);
while (int>-1) do begin
Writeln(10 div int);
Dec(Int);
end;
except
on err:exception do Writeln(err.Message);
end;
with Author do begin
FirstName:='Ozz';
LastName:='Nixon';
end;
Writeln(Author.FirstName,' ',Author.LastName);
end.
Output
1
2
3
4
5
6
7
8
9
10
1
1
1
1
1
2
2
3
5
10
Division by zero
Ozz Nixon
See Also
Begin,
End,
Except,
For,
Repeat,
Try,
While,
With.