Difference between revisions of "Constant"
From Lazarus wiki
Jump to navigationJump to search (edit) |
(review) |
||
Line 1: | Line 1: | ||
{{Constant}} | {{Constant}} | ||
− | A '''constant''' is a variable that does not change, it has a | + | A '''constant''' is a variable that does not change, it has a final value. |
− | Constants are defined in the [[Const#Const_Section|const]] | + | 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. |
− | Some special Free Pascal constants: | + | |
+ | Some special Free Pascal constants are: | ||
Logical truth values | Logical truth values | ||
− | * [[False]] | + | * <code>[[False|false]]</code> |
− | * [[True]] | + | * <code>[[True|true]]</code> |
+ | |||
+ | data type limits | ||
+ | * <code>[[Nil|nil]]</code>: empty pointer value | ||
+ | * <code>[[Maxint|maxint]]</code>: largest possible <code>[[Integer|integer]]</code> value | ||
− | |||
− | |||
− | + | The mathematical value [[Pi|π]] is realized as a function in <code>System.Pi</code>, so you may shadow (redefine) it on your own. | |
− | |||
− | == | + | == see also == |
− | * [[Const]] | + | * <code>[[Const]]</code> |
* [[Constants]] | * [[Constants]] | ||
[[Category:Constants]] | [[Category:Constants]] | ||
[[Category:Pascal]] | [[Category:Pascal]] |
Revision as of 13:26, 24 January 2018
│
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
, so you may shadow (redefine) it on your own.