Difference between revisions of "Percent sign"

From Free Pascal wiki
Jump to navigationJump to search
(add note about exemptions)
 
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" enclose="none">37</syntaxhighlight> (or [[Hexadecimal|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" 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" enclose="none">%</syntaxhighlight>  (pronounced "percent sign") is used in [[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" enclose="none">{%directive}</syntaxhighlight>
+
The percent sign also appears in Lazarus [[IDE directives]] of the form <syntaxhighlight lang="pascal" inline>{%directive}</syntaxhighlight>
  
  
Line 39: Line 39:
  
 
== 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.
+
* <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:

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
Light bulb  Note: Binary number literals are not supported in {$mode Delphi} and {$mode TP}.

See also