Difference between revisions of "period"

From Lazarus wiki
m (Remove categories (defined in the template))
m (range: insert link to subrange types)
(One intermediate revision by the same user not shown)
Line 38: Line 38:
== range ==
== range ==
Two consecutive dots <syntaxhighlight lang="pascal" inline>..</syntaxhighlight> let you specify an ordinal type sub-range.
Two consecutive dots <syntaxhighlight lang="pascal" inline>..</syntaxhighlight> let you specify an ordinal [[subrange types|type sub-range]].
<syntaxhighlight lang="pascal">
<syntaxhighlight lang="pascal">
Line 69: Line 69:

Latest revision as of 17:48, 9 July 2020

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

radix mark

Pascal uses the . (dot) to separate the integer and fractional part in literal decimal integers.

myReal := 6.28318

At least one digit in front of the period is mandatory. A 0 integer part must not be omitted.

Numbers noted in a non-decimal base can not be noted in that way. E. g. the numeric value “a half” can not be written as %0.1 (% being the prefix marking binary numbers).

identifier scope selector

For structured data types the dot separates the data structure identifier from its individual components, i. e. methods or data fields.

 1 program recordDemo(input, output, stderr);
 3 uses
 4 	Linux;
 6 var
 7 	info: TSysInfo;
 8 begin
 9 	if sysInfo(@info) <> 0 then
10 	begin
11 		halt(1);
12 	end;
14 	writeLn('uptime: ', info.uptime, ' seconds');
16 	with info do
17 	begin
18 		writeLn('total free: ', freeram, ' bytes');
19 	end;
20 end.


Two consecutive dots .. let you specify an ordinal type sub-range.

	signumCodomain = -1..1;

This is the same as math.TValueSign.

module end

The main block of any module, i. e. program, unit or library, has to be closed with an end “dot”:

program hiWorld(input, output, stderr);

	writeLn('Hi world!');

It can be seen as an adoption of natural (written) languages, where a full stop marks an end of a sentence.

Anything else after the final end., assuming syntactical correctness, will be ignored by the compiler.


Unit names containing dots create namespaces.

ASCII value

In ASCII, the character code decimal 46 (or hexadecimal 2E) is defined to be . (full stop).

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)