FreePascal Information Logo Friend of FreePascal Compiler Title
Articles with Feedback, FPC News Library, PDF Collection, Mail Lists, Books, Newsgroups, IRC Open online discussion areas Research and Tutorials Tools, Compilers and Utilities Blurbs about us, advertising, etc.
Welcome to the FoFPC Pascal Language DO

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 Source IconDownload 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.
 Links and Products we find useful



ButtonGenerator.com
Valid XHTML 1.0 Transitional Internet Map
Programmer's Heaven
grat-i-fi-ca-tion - noun
the state of being gratified; great satisfaction.


"FoFPC is simply brilliant, a single site with exactly what I was looking for - you made this so easy for me!"

Doug Edwards
eXtreme Accounting
Locations of visitors to this page world map hits counter
Copyright 2009 by 3F, LLC. All rights reserved. Worldwide.
Your request was processed by server #3 in 0.199255 secs.

sponsor
This sponsor helps us with our documentation