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 BEGIN

begin


     The Begin keyword is fundamental to PASCAL - it starts statement blocks. The Begin-end pair fence in a set of statements. You may place such a block anywhere in your code. It is particularly sensible in if and for statements, even if only one statement is required. It means that adding an additional statement in the future is easy.

Example

    Download Source IconDownload This Source for Free Pascal
var
  myChars : array[1..2] of char;
  myBytes : array[1..2] of Byte;
  i : Integer;

// The begin statement always starts the code part of a subroutine
Begin
  // Use a for block to assign to both arrays
  for i := 1 to 2 do Begin
    myChars[i] := Chr(i+64);
    myBytes[i] := i+64;
  end;

  // Use a for block to observe the contents
  for i := 1 to 2 do Begin
    Writeln('myChars[',i,'] = ',myChars[i]);
    Writeln('myBytes[',i,'] = ',myBytes[i]);
  end;
end.

Output

myChars[1] = A
myBytes[1] = 65
myChars[2] = B
myBytes[2] = 66

See Also

If. For, Function, Procedure, While.
 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.


I am very happy to see that FoFPC is alive, we need more developers working on this great language.
Matias Vara
toro.sourceforge.net
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 #2 in 0.004368 secs.

sponsor
This sponsor helps us with our documentation