Quick start manual

4-6
Delphi Language Guide
Comments and compiler directives
Comments and compiler directives
Comments are ignored by the compiler, except when they function as separators
(delimiting adjacent tokens) or compiler directives.
There are several ways to construct comments:
{ Text between a left brace and a right brace constitutes a comment. }
(* Text between a left-parenthesis-plus-asterisk and an
asterisk-plus-right-parenthesis also constitutes a comment. *)
// Any text between a double-slash and the end of the line constitutes a comment.
Comments that are alike cannot be nested. For instance, {{}} will not work, but (*{}*)
will. This is useful for commenting out sections of code that also contain comments.
A comment that contains a dollar sign ($) immediately after the opening { or (* is a
compiler directive. For example,
{$WARNINGS OFF}
tells the compiler not to generate warning messages.
Expressions
An expression is a construction that returns a value. For example,
X { variable }
@X { address of a variable }
15 { integer constant }
InterestRate { variable }
Calc(X,Y) { function call }
X * Y { product of X and Y }
Z / (1 - Z) { quotient of Z and (1 - Z) }
X = 1.5 { Boolean }
C in Range1 { Boolean }
not Done { negation of a Boolean }
['a','b','c'] { set }
Char(48) { value typecast }
The simplest expressions are variables and constants (described in Chapter 5, “Data
types, variables, and constants”). More complex expressions are built from simpler
ones using operators, function calls, set constructors, indexes, and typecasts.
Operators
Operators behave like predefined functions that are part of the the Delphi language.
For example, the expression (X + Y) is built from the variables X and Y—called
operands—with the + operator; when X and Y represent integers or reals, (X + Y)
returns their sum. Operators include @, not, ^, *, /, div, mod, and, shl, shr, as, +, , or,
xor, =, >, <, <>, <=, >=, in, and is.