Difference between revisions of "Is"
From Free Pascal wiki
Jump to navigationJump to search (_two_ occurences of is) |
m (Fixed syntax highlighting) |
||
Line 1: | Line 1: | ||
{{Is}} | {{Is}} | ||
− | |||
− | |||
− | |||
− | == operator == | + | Back to [[Reserved words]]. |
+ | |||
+ | |||
+ | The [[Reserved word|reserved word]] <syntaxhighlight lang="delphi" enclose="none">is</syntaxhighlight> appears as: | ||
+ | |||
+ | * an [[Operator|operator symbol]] in [[object-oriented programming]], or as a | ||
+ | * a modifier qualifying [[Procedural variable|routine variable]] (<syntaxhighlight lang="delphi" enclose="none">is | ||
+ | nested</syntaxhighlight>). | ||
+ | |||
+ | == Operator == | ||
+ | |||
The operator <syntaxhighlight lang="delphi" enclose="none">is</syntaxhighlight> tests, whether an object (first operand) is an instance of a [[Class|class]] or its children. | The operator <syntaxhighlight lang="delphi" enclose="none">is</syntaxhighlight> tests, whether an object (first operand) is an instance of a [[Class|class]] or its children. | ||
<syntaxhighlight lang="delphi">fruit is citrusFruit</syntaxhighlight>is equivalent to<syntaxhighlight lang="delphi">fruit.inheritsFrom(citrusFruit)</syntaxhighlight>. | <syntaxhighlight lang="delphi">fruit is citrusFruit</syntaxhighlight>is equivalent to<syntaxhighlight lang="delphi">fruit.inheritsFrom(citrusFruit)</syntaxhighlight>. | ||
The [[expression]] is [[false and true|<syntaxhighlight lang="pascal" enclose="none">true</syntaxhighlight>]] if and only if <syntaxhighlight lang="pascal" enclose="none">fruit</syntaxhighlight> descends from <syntaxhighlight lang="pascal" enclose="none">citrusFruit</syntaxhighlight>. | The [[expression]] is [[false and true|<syntaxhighlight lang="pascal" enclose="none">true</syntaxhighlight>]] if and only if <syntaxhighlight lang="pascal" enclose="none">fruit</syntaxhighlight> descends from <syntaxhighlight lang="pascal" enclose="none">citrusFruit</syntaxhighlight>. | ||
− | == | + | == Modifier == |
+ | |||
If <syntaxhighlight lang="pascal" enclose="none">{$modeSwitch nestedProcVars+}</syntaxhighlight> or [[Mode iso|<syntaxhighlight lang="pascal" enclose="none">{$mode ISO}</syntaxhighlight>]] routine variables declared with the modifier <syntaxhighlight lang="delphi" enclose="none">is nested</syntaxhighlight> allows those to be assigned to nested routines. | If <syntaxhighlight lang="pascal" enclose="none">{$modeSwitch nestedProcVars+}</syntaxhighlight> or [[Mode iso|<syntaxhighlight lang="pascal" enclose="none">{$mode ISO}</syntaxhighlight>]] routine variables declared with the modifier <syntaxhighlight lang="delphi" enclose="none">is nested</syntaxhighlight> allows those to be assigned to nested routines. | ||
Otherwise only global routines' addresses can be assigned to routine variables. | Otherwise only global routines' addresses can be assigned to routine variables. |
Revision as of 08:17, 18 February 2020
│
Deutsch (de) │
English (en) │
suomi (fi) │
Back to Reserved words.
The reserved word is
appears as:
- an operator symbol in object-oriented programming, or as a
- a modifier qualifying routine variable (
is nested
).
Operator
The operator is
tests, whether an object (first operand) is an instance of a class or its children.
fruit is citrusFruit
is equivalent to
fruit.inheritsFrom(citrusFruit)
.
The expression is true
if and only if fruit
descends from citrusFruit
.
Modifier
If {$modeSwitch nestedProcVars+}
or {$mode ISO}
routine variables declared with the modifier is nested
allows those to be assigned to nested routines.
Otherwise only global routines' addresses can be assigned to routine variables.