Difference between revisions of "period"

From Free Pascal wiki
Jump to navigationJump to search
m (→‎range: typo)
m (→‎range: insert link to subrange types)
 
(5 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
== radix mark ==
 
== radix mark ==
 
+
[[Pascal]] uses the <syntaxhighlight lang="pascal" inline>.</syntaxhighlight> (dot) to separate the integer and fractional part in literal decimal integers.
[[Pascal]] uses the <syntaxhighlight lang="pascal" enclose="none">.</syntaxhighlight> (dot) to separate the integer and fractional part in literal decimal integers.
 
 
<syntaxhighlight lang="pascal">
 
<syntaxhighlight lang="pascal">
 
myReal := 6.28318
 
myReal := 6.28318
 
</syntaxhighlight>
 
</syntaxhighlight>
 
At least one digit in front of the period is mandatory.
 
At least one digit in front of the period is mandatory.
A <syntaxhighlight lang="pascal" enclose="none">0</syntaxhighlight> integer part must not be omitted.
+
A <syntaxhighlight lang="pascal" inline>0</syntaxhighlight> integer part must not be omitted.
  
 
Numbers noted in a non-decimal base can not be noted in that way.
 
Numbers noted in a non-decimal base can not be noted in that way.
E.g. a half can not be written as <syntaxhighlight lang="pascal" enclose="none">%0.1</syntaxhighlight> ([[Percent sign|<syntaxhighlight lang="pascal" enclose="none">%</syntaxhighlight>]] being the prefix marking [[Binary numeral system|binary numbers]]).
+
E. g. the numeric value “a half” can not be written as <syntaxhighlight lang="pascal" inline>%0.1</syntaxhighlight> ([[Percent sign|<syntaxhighlight lang="pascal" inline>%</syntaxhighlight>]] being the prefix marking [[Binary numeral system|binary numbers]]).
  
 
== identifier scope selector ==
 
== identifier scope selector ==
 
+
For structured data types the dot separates the data structure identifier from its individual components, i. e. methods or data fields.
For structured data types the dot separates the data structure identifier from its individual components, i.e. methods or data fields.
 
 
<syntaxhighlight lang="pascal" line highlight="14,16-19">
 
<syntaxhighlight lang="pascal" line highlight="14,16-19">
 
program recordDemo(input, output, stderr);
 
program recordDemo(input, output, stderr);
Line 40: Line 38:
  
 
== range ==
 
== range ==
 
+
Two consecutive dots <syntaxhighlight lang="pascal" inline>..</syntaxhighlight> let you specify an ordinal [[subrange types|type sub-range]].
Two consecutive dots <syntaxhighlight lang="pascal" enclose="none">..</syntaxhighlight> let you specify an integer sub-range.
 
 
<syntaxhighlight lang="pascal">
 
<syntaxhighlight lang="pascal">
 
type
 
type
 
signumCodomain = -1..1;
 
signumCodomain = -1..1;
 
</syntaxhighlight>
 
</syntaxhighlight>
<small>This is the same as {{Doc|package=RTL|unit=math|identifier=tvaluesign|text=<syntaxhighlight lang="pascal" enclose="none">math.TValueSign</syntaxhighlight>}}.</small>
+
<small>This is the same as {{Doc|package=RTL|unit=math|identifier=tvaluesign|text=<syntaxhighlight lang="pascal" inline>math.TValueSign</syntaxhighlight>}}.</small>
  
 
== module end ==
 
== module end ==
The main block of any module, i.e. [[Program|<syntaxhighlight lang="pascal" enclose="none">program</syntaxhighlight>]], [[Unit|<syntaxhighlight lang="pascal" enclose="none">unit</syntaxhighlight>]] or [[Library|<syntaxhighlight lang="pascal" enclose="none">library</syntaxhighlight>]], has to be closed with an [[End|<syntaxhighlight lang="pascal" enclose="none">end</syntaxhighlight>]] “dot”:
+
The main block of any module, i. e. [[Program|<syntaxhighlight lang="pascal" inline>program</syntaxhighlight>]], [[Unit|<syntaxhighlight lang="pascal" inline>unit</syntaxhighlight>]] or [[Library|<syntaxhighlight lang="pascal" inline>library</syntaxhighlight>]], has to be closed with an [[End|<syntaxhighlight lang="pascal" inline>end</syntaxhighlight>]] “dot”:
  
 
<syntaxhighlight lang="pascal" highlight="5">
 
<syntaxhighlight lang="pascal" highlight="5">
Line 61: Line 58:
 
It can be seen as an adoption of natural (written) languages, where a full stop marks an end of a sentence.
 
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 <syntaxhighlight lang="pascal" enclose="none">end.</syntaxhighlight>, assuming syntactical correctness, will be ignored by the [[Compiler|compiler]].
+
Anything else after the final <syntaxhighlight lang="pascal" inline>end.</syntaxhighlight>, assuming syntactical correctness, will be ignored by the [[Compiler|compiler]].
 
 
  
 
== namespaces ==
 
== namespaces ==
 
+
[[Unit]] names containing dots create [[Namespaces|namespaces]].
Unit names containing dots create namespaces.
 
  
 
== ASCII value ==
 
== ASCII value ==
 
+
In [[ASCII]], the character code decimal <syntaxhighlight lang="pascal" inline>46</syntaxhighlight>  
In [[ASCII]], the character code decimal <syntaxhighlight lang="pascal" enclose="none">46</syntaxhighlight>  
+
(or [[Hexadecimal|hexadecimal]] <syntaxhighlight lang="pascal" inline>2E</syntaxhighlight>) is defined to be  
(or [[Hexadecimal|hexadecimal]] <syntaxhighlight lang="pascal" enclose="none">2E</syntaxhighlight>) is defined to be  
+
<syntaxhighlight lang="pascal" inline>.</syntaxhighlight> (full stop).
<syntaxhighlight lang="pascal" enclose="none">.</syntaxhighlight> (full stop).
 
  
 
{{Symbols}}
 
{{Symbols}}
  
 
[[Category:Code]]
 
[[Category:Code]]

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.

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

range

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

type
	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);

begin
	writeLn('Hi world!');
end.

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.

namespaces

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)