Plus/fi: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Plus/fi
| Old | New | Line | |
|---|---|---|---|
| 1 | + | <div style="float:right; margin: 0 10px 10px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;"> | |
| 2 | + | ||
| 3 | + | \+ | |
| 4 | + | ||
| 5 | + | </div> | |
| 6 | + | ||
| 7 | + | Symboli `+` (joka lausutaan “plus”) käytetään: | |
| 8 | + | ||
| 9 | + | - ilmaisemaan että luvulla on positiivinen etumerkki, | |
| 10 | + | - kahden tai useamman luvun yhteenlaskeminen | |
| 11 | + | - käytetään [[Set|joukko-opissa]] yhdisteenä eli unionina | |
| 12 | + | - (FPC) liittää kaksi merkkijonoa peräkkäin (tai merkkiä paitsi [[PChar|pchar]]). | |
| 13 | + | ||
| 14 | + | [[ASCII/fi|ASCII]]:ssa merkkikoodin desimaalinen arvo `43` (tai [[Hexadecimal/fi|heksadesimaalisena]] `2B` ) määritellään olevan `+` (Plus-merkki). | |
| 15 | + | ||
| 16 | + | ``` pascal | |
| 17 | + | program plusDemo(input, output, stderr); | |
| 18 | + | ||
| 19 | + | var | |
| 20 | + | x: longint; | |
| 21 | + | g: set of (foo, bar); | |
| 22 | + | m: string; | |
| 23 | + | begin | |
| 24 | + | // unary operator: positive sign | |
| 25 | + | x := +7; // x saa arvokseen positiivisen luvun 7 | |
| 26 | + | x := +$100; // x saa arvokseen 256 | |
| 27 | + | // (dollarin merkki merkitsee heksadesimaaliesitystä luvulle) | |
| 28 | + | ||
| 29 | + | // addition | |
| 30 | + | x := 7 + 7; // x saa arvokseen 14 | |
| 31 | + | x := 7 + 7 + 7 + 7 + 7 + 7; // x saa arvokseen 42 | |
| 32 | + | ||
| 33 | + | // union of sets | |
| 34 | + | g := [foo] + [bar]; // g saa arvokseen [foo, bar] | |
| 35 | + | ||
| 36 | + | // merkkijonojen ja / tai merkkien yhteenliittäminen (FPC / Delphi-laajennus) | |
| 37 | + | m := 'Hello ' + 'world!'; // m saa arvokseen 'Hello world!' | |
| 38 | + | end. | |
| 39 | + | ``` | |
| 40 | + | ||
| 41 | + | ## Katso myös | |
| 42 | + | ||
| 43 | + | - [`system.add`](https://www.freepascal.org/docs-html/rtl/system/add.html) | |
| 44 | + | - [`system.concat`](https://www.freepascal.org/docs-html/rtl/system/concat.html) returns concatenation of strings | |
| 45 | + | - [`strings.strcat`](https://www.freepascal.org/docs-html/rtl/strings/strcat.html) returns concatenation of [[PChar|pchar]] strings | |
| 46 | + | ||
| 47 | + | --- | |
| 48 | + | *From the Free Pascal wiki, page "Plus/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).* |
