mirror of
https://github.com/nasa/fpp.git
synced 2026-04-12 14:13:33 -05:00
39 lines
975 B
Plaintext
39 lines
975 B
Plaintext
=== Constant Definitions
|
|
|
|
A *constant definition* associates a name with a compile-time constant
|
|
value. You can use the name in place of the value elsewhere in the
|
|
model.
|
|
|
|
==== Syntax
|
|
|
|
_[_
|
|
`dictionary`
|
|
_]_
|
|
`constant`
|
|
<<Lexical-Elements_Identifiers,_identifier_>>
|
|
`=`
|
|
<<Expressions,_expression_>>
|
|
|
|
==== Semantics
|
|
|
|
_expression_ must
|
|
<<Evaluation,evaluate>>
|
|
to a compile-time constant value _v_. At any model point where the
|
|
<<Scoping-of-Names_Qualified-Identifiers,qualified identifier>> _Q_ refers to
|
|
the constant definition according to the
|
|
<<Scoping-of-Names_Resolution-of-Qualified-Identifiers,scoping
|
|
rules for names>>, you can use _Q_ as a name for _v_.
|
|
|
|
If the optional keyword `dictionary` is present, then the
|
|
definition must conform to the rules stated in the
|
|
<<Definitions_Dictionary-Definitions,dictionary definitions>> section.
|
|
|
|
==== Examples
|
|
|
|
[source,fpp]
|
|
----
|
|
constant a = 0 # a has value 0
|
|
constant b = 1.0 # b has value 1.0
|
|
constant c = a # c has value 0
|
|
----
|