avainsana end päättää kokonaisuuden.
Se esintyy useissa eri paikoissa:
- merkitä moduulin lopun, eli esim.
ohjelma,käännösyksikkö (unit)tailibrary - merkitä lohkon tai ohjeistuksen lopun
- sulkea joitakin kielirakenteita:
if … then … endtaiCase…of…endrakenteen lopetus, mutta myöstry … except … finally … end(poikkeukset)
- lopettaa tietyt type määrittelyt, kuten
object,recordjaclass
Esimerkiksi:
procedure proc0;
var
a, b: integer;
begin
…
end;
Pääsääntö on että jokaisen end sanan perässä on oltava puolipilkku. End sanaa edeltävä lause ei vaadi puolipistettä.
Sitä käytetään myös Pascal-moduulin lopettamiseen, jolloin sitä seuraa piste, joka ei siis ole puolipilkku (alla olevassa esimerkissä viimeinen puolipilkku on vapaaehtoinen):
program proc1;
var
SL: TStrings;
begin
SL := TStringlist.create;
try
…
finally
SL.free;
end;
end.
end käytetään ilmaisemaan käännösyksikön (unit) lopun:
unit detent;
uses math;
procedure delta(r:real);
implementation
procedure delta;
begin
...
end;
...
(* Huomaa: Ei vastaavaa '''begin''' lausetta *)
end.
Se lopettaa record määrittelyn:
Type
ExampleRecord = Record
Values: array [1..200] of real;
NumValues: Integer; { holds the actual number of points in the array }
Average: Real { holds the average or mean of the values in the array }
End;
Keywords: begin — do — else — end — for — if — repeat — then — until — while