ava/notes/constants.md

629 B

Constants

Constants are definitions which provide a name and explicit type for some value. 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.