Content deleted Content added
Filled in 1 bare reference(s) with reFill 2 |
Tags: Reverted Visual edit |
||
Line 200:
Subranges of any [[ordinal data type]] (any simple type except real) can also be made:
:
:<syntaxhighlight lang="pascal">▼
var▼
x : 1..10;▼
y : 'a'..'z';▼
</syntaxhighlight>▼
===Set types===
Line 226 ⟶ 222:
if (i > 4) and (i < 11) then ...
</syntaxhighlight>
▲var
▲ x : 1..10;
▲ y : 'a'..'z';
</syntaxhighlight>Sets of non-contiguous values can be particularly useful, in terms of both performance and readability:▼
:
▲Sets of non-contiguous values can be particularly useful, in terms of both performance and readability:
if i in [0..3, 7, 9, 12..15] then ...▼
For these examples, which involve sets over small domains, the improved performance is usually achieved by the compiler representing set variables as [[bit vector]]s. The set [[Operator (programming)|operators]] can then be implemented efficiently as bitwise machine code operations.
===Record types===
▲if i in [0..3, 7, 9, 12..15] then ...
</syntaxhighlight>An example of a Pascal record type:▼
:
▲An example of a Pascal record type:
An example of a variant record type:
|