Difference between revisions of "Percent sign"
From Lazarus wiki
Jump to navigationJump to searchLine 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" enclose="none">37</syntaxhighlight> (or hexadecimal <syntaxhighlight lang="pascal" enclose="none">25</syntaxhighlight>) is defined to be <syntaxhighlight lang="pascal" enclose="none">%</syntaxhighlight> . | + | In [[ASCII]], the character code decimal <syntaxhighlight lang="pascal" enclose="none">37</syntaxhighlight> (or [[Hexadecimal|hexadecimal]] <syntaxhighlight lang="pascal" enclose="none">25</syntaxhighlight>) is defined to be <syntaxhighlight lang="pascal" enclose="none">%</syntaxhighlight> . |
The symbol <syntaxhighlight lang="pascal" enclose="none">%</syntaxhighlight> (pronounced "percent sign") is used in [[Pascal]]: | The symbol <syntaxhighlight lang="pascal" enclose="none">%</syntaxhighlight> (pronounced "percent sign") is used in [[Pascal]]: | ||
Line 9: | Line 9: | ||
The percent sign also appears in Lazarus [[IDE directives]] of the form <syntaxhighlight lang="pascal" enclose="none">{%directive}</syntaxhighlight> | The percent sign also appears in Lazarus [[IDE directives]] of the form <syntaxhighlight lang="pascal" enclose="none">{%directive}</syntaxhighlight> | ||
+ | |||
+ | |||
+ | == Example == | ||
+ | |||
+ | <syntaxhighlight lang="pascal"> | ||
+ | |||
+ | program simple_binary_digit; | ||
+ | |||
+ | var b:byte; | ||
+ | begin | ||
+ | b := %1010011; | ||
+ | writeln (b); | ||
+ | writeln (binStr(b,8)); | ||
+ | writeln ; | ||
+ | writeln ('Press [Enter] to finish'); | ||
+ | readln; | ||
+ | end. | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | The output prints as follows: | ||
+ | |||
+ | 83 | ||
+ | 01010011 | ||
+ | |||
+ | Press [enter] to finish | ||
+ | |||
+ | |||
+ | == See also == | ||
+ | * [[Function|<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 20:11, 6 July 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