From Free Pascal wiki
Revision as of 14:48, 4 April 2018 by Bart (talk | contribs) ((a clear all break instead of several (in fact any arbitrary number) of breaks). Thanks to Kai for showing me how to.)
Jump to navigationJump to search

English (en) suomi (fi) français (fr)


The semicolon ASCII or the unicode value is 59 (Hexadecimal $3B).

The semicolon, ; is used to separate statements (unlike other programming languages where it is used to terminate a statement). It is mandatory for most statements, voluntary in some statements, and forbidden in one particular statement.

(In order to explain usage, where Pascal keywords are referred to in the text of this article, they are shown in UPPER case. Program listings will use lower case.)

The semicolon is generally mandatory, and is required after every statement. The places where it is optional are

  • before an END statement

A semicolon is forbidden

  • immediately before an ELSE statement that belongs to an if statement

Notice that a semicolon can occur immediately before an else statement that belongs to a case statement.
Consider the following:

  case a of
    true: if b then DoB;
    else DoNotA;

The else part belongs to the case statement.
DoNotA will be executed if none of the case labels (just one in this case) applies.

Now if you leave out the semicolon after DoB

  case a of
    true: if b then DoB
    else DoNotB;

The else statement now is part of the "if b".
DoNotB will only be executed if a is true, and b is false.

navigation bar: topic: Pascal symbols
single characters

+ (plus)  •  - (minus)  •  * (asterisk)  •  / (slash)
= (equal)  •  > (greater than)  •  < (less than)
. (period)  •  : (colon)  •  ; (semi colon)
^ (hat)  •  @ (at)
$ (dollar sign)  •  & (ampersand)  •  # (hash)
' (single quote)

character pairs

<> (not equal)  •  <= (less than or equal)  •  := (becomes)  •  >= (greater than or equal)

 •  >< (symmetric difference)  •  // (double slash)