Difference between revisions of "Constant"
From Lazarus wiki
Jump to navigationJump to search (removed unsourced claim; nicer syntax highlighting) |
|||
Line 1: | Line 1: | ||
{{Constant}} | {{Constant}} | ||
− | A '''constant''' is a variable that does not change, it has a final value. | + | A '''constant''' is a [[Variable|variable]] that does not change, it has a final value. |
− | Constants are defined in the [[Const#Const_Section|<code>const</code> section]] of a Free Pascal program. When a symbol is defined as constant, the [[Compiler|Free Pascal compiler]] can often do some optimizations to make the output code faster or smaller. | + | Constants are defined in the [[Const#Const_Section|<code>const</code> section]] of a [[FPC|Free Pascal]] [[Program|program]]. When a symbol is defined as constant, the [[Compiler|Free Pascal compiler]] can often do some optimizations to make the output code faster or smaller. |
Line 13: | Line 13: | ||
data type limits | data type limits | ||
− | * [[Nil|<syntaxhighlight lang="pascal" enclose="none">nil</syntaxhighlight>]]: empty pointer value | + | * [[Nil|<syntaxhighlight lang="pascal" enclose="none">nil</syntaxhighlight>]]: empty [[Pointer|pointer]] value |
* [[maxint|<syntaxhighlight lang="pascal" enclose="none">maxint</syntaxhighlight>]]: largest possible [[Integer|<syntaxhighlight lang="pascal" enclose="none">integer</syntaxhighlight>]] value | * [[maxint|<syntaxhighlight lang="pascal" enclose="none">maxint</syntaxhighlight>]]: largest possible [[Integer|<syntaxhighlight lang="pascal" enclose="none">integer</syntaxhighlight>]] value | ||
Line 22: | Line 22: | ||
* [[Const|<syntaxhighlight lang="pascal" enclose="none">const</syntaxhighlight>]] | * [[Const|<syntaxhighlight lang="pascal" enclose="none">const</syntaxhighlight>]] | ||
* [[Constants]] | * [[Constants]] | ||
− | |||
− | |||
− |
Revision as of 21:40, 28 June 2019
│
English (en) │
suomi (fi) │
français (fr) │
русский (ru) │
中文(中国大陆) (zh_CN) │
A constant is a variable that does not change, it has a final value.
Constants are defined in the const
section of a Free Pascal program. When a symbol is defined as constant, the Free Pascal compiler can often do some optimizations to make the output code faster or smaller.
Some special Free Pascal constants are:
Logical truth values
data type limits
The mathematical value π is realized as a function in system.pi
.