Dollar sign: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Dollar sign
| Old | New | Line | |
|---|---|---|---|
| 1 | + | <div style="float:left; margin: 0 25px 20px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;"> | |
| 2 | + | ||
| 3 | + | \$ | |
| 4 | + | ||
| 5 | + | </div> | |
| 6 | + | ||
| 7 | + | In [[ASCII]], the character code decimal `36` (or hexadecimal `24`) is defined to be `$` (dollar sign). | |
| 8 | + | ||
| 9 | + | ## Pascal | |
| 10 | + | ||
| 11 | + | As a [[PXSC]] extension, the symbol `$`, pronounced “dollar sign”, is used to indicate a [[Hexadecimal|hexadecimal]] base.\ | |
| 12 | + | ||
| 13 | + | ``` pascal | |
| 14 | + | program dollarSignDemo(input, output, stderr); | |
| 15 | + | ||
| 16 | + | var | |
| 17 | + | i: longint; | |
| 18 | + | ||
| 19 | + | begin | |
| 20 | + | // '$' as well as '0x' are recognized by readLn | |
| 21 | + | // as hexadecimal base prefixes | |
| 22 | + | readStr('$24', i); | |
| 23 | + | writeLn(i); // will print 36 | |
| 24 | + | writeLn(-$24); // will print -36 | |
| 25 | + | end. | |
| 26 | + | ``` | |
| 27 | + | ||
| 28 | + | An optional sign is written in front the base indicator. | |
| 29 | + | ||
| 30 | + | ## other appearances | |
| 31 | + | ||
| 32 | + | For [[FPC]] and [[Delphi]] [[Compiler|compilers]], the dollar sign appears in [[Compiler directive|compiler directives]] of the form `{$directive}`. | |
| 33 | + | ||
| 34 | + | --- | |
| 35 | + | *From the Free Pascal wiki, page "Dollar sign", as it stood on 2024-02-28 after a change by Alextp, 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).* |
