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