Difference between revisions of "Percent sign"
From Free Pascal wiki
Jump to navigationJump to search (add note about exemptions) |
|||
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" enclose="none">function</syntaxhighlight> [[doc:rtl/system/binstr.html|binStr]] - Convert [[Integer|integer]] to [[String|string]] with binary representation. |
Revision as of 17:42, 7 September 2019
│
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}
.