Difference between revisions of "Constant"

From Lazarus wiki
Jump to navigationJump to search
(edit)
Line 1: Line 1:
 
{{Constant}}
 
{{Constant}}
  
A '''constant''' is something that does not change, a fixed value.
+
A '''constant''' is a variable that does not change, it has a fixed value.
  
Constants are defined in the [[Const|const]] section of the program. When some value are constant the [[Compiler|compiler]] can do some optimizations.
+
Constants are defined in the [[Const#Const_Section|const]] section of a Free Pascal program. When a variable is constant the [[Compiler|Free Pascal compiler]] can often do some optimizations to make the output code faster or smaller.
  
Some special constant values are e.g.
+
Some special Free Pascal constants:
  
 
Logical truth values
 
Logical truth values
Line 14: Line 14:
 
* [[Nil]]
 
* [[Nil]]
  
Mathematical constants
+
Mathematical values
 
* [[Pi]]
 
* [[Pi]]
  

Revision as of 23:20, 18 September 2017

English (en) suomi (fi) français (fr) русский (ru) 中文(中国大陆)‎ (zh_CN)

A constant is a variable that does not change, it has a fixed value.

Constants are defined in the const section of a Free Pascal program. When a variable is constant the Free Pascal compiler can often do some optimizations to make the output code faster or smaller.

Some special Free Pascal constants:

Logical truth values

Empty pointer value

Mathematical values

read more