Delphi Language Guide Delphi for Microsoft Win32 Delphi for the Microsoft. Net framework



Yüklə 0,84 Mb.
Pdf görüntüsü
səhifə53/294
tarix02.01.2022
ölçüsü0,84 Mb.
#41395
1   ...   49   50   51   52   53   54   55   56   ...   294
DelphiLanguageGuide

Compound Statements
A compound statement is a sequence of other (simple or structured) statements to be executed in the order in which
they are written. The compound statement is bracketed by the reserved words begin and end, and its constituent
statements are separated by semicolons. For example:
begin
   Z := X;
   X := Y;
   X := Y;
          end;
The last semicolon before end is optional. So we could have written this as
begin
   Z := X;
   X := Y;
   Y := Z
end;
Compound statements are essential in contexts where Delphi syntax requires a single statement. In addition to
program, function, and procedure blocks, they occur within other structured statements, such as conditionals or
loops. For example:
begin
   I := SomeConstant;
   while I > 0 do
    begin
       ...
       I := I - 1;
    end;
end;
You can write a compound statement that contains only a single constituent statement; like parentheses in a complex
term, begin and end sometimes serve to disambiguate and to improve readability. You can also use an empty
compound statement to create a block that does nothing:
begin
end;

Yüklə 0,84 Mb.

Dostları ilə paylaş:
1   ...   49   50   51   52   53   54   55   56   ...   294




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin