27 lines
629 B
Markdown
27 lines
629 B
Markdown
# Constants
|
|
|
|
_Constants_ are definitions which provide a name and explicit type for some
|
|
[value](values.md). The `const` keyword (definition type) is used to define a
|
|
constant.
|
|
|
|
```
|
|
const weak_pi: Float64 := 3.14
|
|
const my_name: String := "Pat"
|
|
```
|
|
|
|
In general:
|
|
|
|
```
|
|
const <name>: <type> := <value>
|
|
```
|
|
|
|
## Restrictions
|
|
|
|
Constants are subject to the following restrictions:
|
|
|
|
- Constants MUST refer to a literal value.
|
|
- Constants MUST have an explicit type.
|
|
- Constants MAY refer to a record instance.
|
|
- Constants CANNOT require a type constructor.
|
|
- Constants CANNOT refer to functions.
|
|
- Constants CANNOT refer to expressions.
|