Difference between revisions of "Percent sign"
From Free Pascal wiki
Jump to navigationJump to search(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
<div style="float:right; margin: 0 25px 20px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;">%</div> | <div style="float:right; margin: 0 25px 20px 0; padding:40px; font-size:500%; font-family: Georgia; background-color: #f9f9f9; border: 2px solid #777777;">%</div> | ||
− | In [[ASCII]], the character code decimal <syntaxhighlight lang="pascal" | + | In [[ASCII]], the character code decimal <syntaxhighlight lang="pascal" inline>37</syntaxhighlight> (or [[Hexadecimal|hexadecimal]] <syntaxhighlight lang="pascal" inline>25</syntaxhighlight>) is defined to be <syntaxhighlight lang="pascal" inline>%</syntaxhighlight> . |
− | The symbol <syntaxhighlight lang="pascal" | + | The symbol <syntaxhighlight lang="pascal" inline>%</syntaxhighlight> (pronounced "percent sign") is used in [[Pascal]]: |
* it indicates a [[Binary numeral system|binary numeral expression/number]]. | * it indicates a [[Binary numeral system|binary numeral expression/number]]. | ||
− | The percent sign also appears in Lazarus [[IDE directives]] of the form <syntaxhighlight lang="pascal" | + | The percent sign also appears in Lazarus [[IDE directives]] of the form <syntaxhighlight lang="pascal" inline>{%directive}</syntaxhighlight> |
Line 36: | Line 36: | ||
Press [enter] to finish | Press [enter] to finish | ||
+ | {{Note|Binary number literals are not supported in [[Mode Delphi|<syntaxhighlight lang="pascal" inline>{$mode Delphi}</syntaxhighlight>]] and [[Mode TP|<syntaxhighlight lang="pascal" inline>{$mode TP}</syntaxhighlight>]].}} | ||
== See also == | == See also == | ||
− | * | + | * <syntaxhighlight lang="pascal" inline>function</syntaxhighlight> [[doc:rtl/system/binstr.html|binStr]] - Convert [[Integer|integer]] to [[String|string]] with binary representation. |
Latest revision as of 17:15, 6 August 2022
│
English (en) │
suomi (fi) │
français (fr) │
português (pt) │
русский (ru) │
%
In ASCII, the character code decimal 37
(or hexadecimal 25
) is defined to be %
.
The symbol %
(pronounced "percent sign") is used in Pascal:
- it indicates a binary numeral expression/number.
The percent sign also appears in Lazarus IDE directives of the form {%directive}
Example
program simple_binary_digit;
var b:byte;
begin
b := %1010011;
writeln (b);
writeln (binStr(b,8));
writeln ;
writeln ('Press [Enter] to finish');
readln;
end.
The output prints as follows:
83 01010011 Press [enter] to finish
Note: Binary number literals are not supported in
{$mode Delphi}
and {$mode TP}
.