Percent sign/pt: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Percent sign/pt
| 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 | + | Em [[ASCII/pt|ASCII]], o caractere de código decimal `37` (ou [[Hexadecimal/pt|hexadecimal]] `25`) é definido como `%`. | |
| 8 | + | ||
| 9 | + | O símbolo `%` ("sinal de porcentagem") é utilizado em [[Pascal/pt|Pascal]]: | |
| 10 | + | ||
| 11 | + | - indica um [[Binary numeral system/pt|número/expressão no sistema numérico binário]]. | |
| 12 | + | ||
| 13 | + | O sinal de porcentagem também aparece nas diretivas do Lazarus da forma `{%directive}`. | |
| 14 | + | ||
| 15 | + | ## Exemplo | |
| 16 | + | ||
| 17 | + | ``` pascal | |
| 18 | + | ||
| 19 | + | program digito_binario_simples; | |
| 20 | + | ||
| 21 | + | var b:byte; | |
| 22 | + | begin | |
| 23 | + | b := %1010011; | |
| 24 | + | writeln (b); | |
| 25 | + | writeln (binStr(b,8)); | |
| 26 | + | writeln ; | |
| 27 | + | writeln ('Tecle [Enter] para sair'); | |
| 28 | + | readln; | |
| 29 | + | end. | |
| 30 | + | ``` | |
| 31 | + | ||
| 32 | + | Será impresso na saída algo como: | |
| 33 | + | ||
| 34 | + | `83`\ | |
| 35 | + | `01010011`\ | |
| 36 | + | ` `\ | |
| 37 | + | `Tecle [Enter] para sair` | |
| 38 | + | ||
| 39 | + | > **Note:** Literais de números binários não são suportados nos modos [[Mode Delphi/pt|{$mode Delphi}]] e [[Mode TP/pt|{$mode TP}]]. | |
| 40 | + | ||
| 41 | + | ## Ver também | |
| 42 | + | ||
| 43 | + | - `function` [[doc:rtl/system/binstr.html|binStr]] — Converte um *[[Integer/pt|Integer]]* (inteiro) para uma [[String/pt|String]] contendo a sua representação binária. | |
| 44 | + | ||
| 45 | + | --- | |
| 46 | + | *From the Free Pascal wiki, page "Percent sign/pt", 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).* |
