Is: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Is
| Old | New | Line | |
|---|---|---|---|
| 1 | + | The [[Reserved word|reserved word]] `is` appears as: | |
| 2 | + | ||
| 3 | + | - an [[Operator|operator symbol]] in [[object-oriented programming]], or as a | |
| 4 | + | - a modifier qualifying [[Procedural variable|routine variable]] (`is nested`). | |
| 5 | + | ||
| 6 | + | ## Operator | |
| 7 | + | ||
| 8 | + | The operator `is` tests, whether an object (first operand) is an instance of a [[Class|class]] or its children. | |
| 9 | + | ||
| 10 | + | ```delphi | |
| 11 | + | fruit is citrusFruit | |
| 12 | + | ``` | |
| 13 | + | ||
| 14 | + | is equivalent to | |
| 15 | + | ||
| 16 | + | ```delphi | |
| 17 | + | fruit.inheritsFrom(citrusFruit) | |
| 18 | + | ``` | |
| 19 | + | ||
| 20 | + | . The [[expression]] is [[false and true|true]] if and only if `fruit` descends from `citrusFruit`. | |
| 21 | + | ||
| 22 | + | ## Modifier | |
| 23 | + | ||
| 24 | + | If `{$modeSwitch nestedProcVars+}` or [[Mode iso|{$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. | |
| 25 | + | ||
| 26 | + | --- | |
| 27 | + | *From the Free Pascal wiki, page "Is", as it stood on 2020-05-16 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
