Percent sign: what changed
Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | % | |
| 2 | 2 | ||
| 3 | 3 | In [[ASCII]], the character code decimal `37` (or [[Hexadecimal|hexadecimal]] `25`) is defined to be `%` . | |
| 4 | 4 | ||
| 5 | 5 | The symbol `%` (pronounced "percent sign") is used in [[Pascal]]: | |
| 6 | 6 | ||
| 7 | 7 | - it indicates a [[Binary numeral system|binary numeral expression/number]]. | |
| 8 | 8 | ||
| 9 | 9 | The percent sign also appears in Lazarus [[IDE directives]] of the form `{%directive}` | |
| 10 | 10 | ||
| 11 | 11 | ## Example | |
| 12 | 12 | ||
| 13 | 13 | ``` pascal | |
| 14 | 14 | ||
| 15 | 15 | program simple_binary_digit; | |
| 16 | 16 | ||
| 17 | 17 | var b:byte; | |
| 18 | 18 | begin | |
| 19 | 19 | b := %1010011; | |
| 20 | 20 | writeln (b); | |
| 21 | 21 | writeln (binStr(b,8)); | |
| 22 | 22 | writeln ; | |
| 23 | 23 | writeln ('Press [Enter] to finish'); | |
| 24 | 24 | readln; | |
| 25 | 25 | end. | |
| 26 | 26 | ``` | |
| 27 | 27 | ||
| 28 | 28 | The output prints as follows: | |
| 29 | 29 | ||
| 30 | - | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 30 | + | ```text | |
| 31 | + | 83 | |
| 32 | + | 01010011 | |
| 33 | + | ||
| 34 | + | Press [enter] to finish | |
| 35 | + | ``` | |
| 34 | 36 | ||
| 35 | 37 | > **Note:** Binary number literals are not supported in [[Mode Delphi|{$mode Delphi}]] and [[Mode TP|{$mode TP}]]. | |
| 36 | 38 | ||
| 37 | 39 | ## See also | |
| 38 | 40 | ||
| 39 | 41 | - `function` [[doc:rtl/system/binstr.html|binStr]] - Convert [[Integer|integer]] to [[String|string]] with binary representation. | |
| 40 | 42 | ||
| 41 | 43 | --- | |
| 42 | 44 | *From the Free Pascal wiki, page "Percent sign", 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).* |
