Is/fi: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Is/fi
| Old | New | Line | |
|---|---|---|---|
| 1 | + | [[Reserved word/fi|Varattu sana]] `is` kuuluu olio-ohjelmointiin. `Is` operaattorilla testataan, onko olio tietyn [[Type/fi|tyypin]] (joka on [[Class/fi|luokan]] tai lapsiluokan) esiintymä. `Is` operaattori testaa sen vasemmalla puolella olevan muuttujan ja sen oikealla puolella olevan tyypin. Tuloksena on [[Boolean/fi|boolean]] arvo, joka osoittaa, kuuluuko objekti tähän tyyppiin vai ei. | |
| 2 | + | ||
| 3 | + | Esimerkki: | |
| 4 | + | ||
| 5 | + | ``` pascal | |
| 6 | + | ... | |
| 7 | + | If fruit is TCitrusFruit then ... // Tarkistaa, kuuluuko fruit olio TCitrusFruit-luokkaan | |
| 8 | + | ... | |
| 9 | + | ``` | |
| 10 | + | ||
| 11 | + | --- | |
| 12 | + | *From the Free Pascal wiki, page "Is/fi", as it stood on 2022-08-06 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).* |
