Quick start manual

Syntactic elements
4-19
Declarations and statements
Simple statements
A simple statement doesn’t contain any other statements. Simple statements include
assignments, calls to procedures and functions, and goto jumps.
Assignment statements
An assignment statement has the form
variable := expression
where variable is any variable reference—including a variable, variable typecast,
dereferenced pointer, or component of a structured variableand expression is any
assignment-compatible expression (within a function block, variable can be replaced
with the name of the function being defined. See Chapter 6, “Procedures and
functions”). The := symbol is sometimes called the assignment operator.
An assignment statement replaces the current value of variable with the value of
expression. For example,
I := 3;
assigns the value 3 to the variable I. The variable reference on the left side of the
assignment can appear in the expression on the right. For example,
I := I + 1;
increments the value of I. Other assignment statements include
X := Y + Z;
Done := (I >= 1) and (I < 100);
Hue1 := [Blue, Succ(C)];
I := Sqr(J) - I * K;
Shortint(MyChar) := 122;
TByteRec(W).Hi := 0;
MyString[I] := 'A';
SomeArray[I + 1] := P^;
TMyObject.SomeProperty := True;
Procedure and function calls
A procedure call consists of the name of a procedure (with or without qualifiers),
followed by a parameter list (if required). Examples include
PrintHeading;
Transpose(A, N, M);
Find(Smith, William);
Writeln('Hello world!');
DoSomething();
Unit1.SomeProcedure;
TMyObject.SomeMethod(X,Y);
With extended syntax enabled ({$X+}), function calls, like calls to procedures, can be
treated as statements in their own right:
MyFunction(X);