Skip to content

Constants

You can attach names to values. Named values are called constants, because once defined those names can never refer to another value.

theAnswer = 42
aQuestion = "What is the answer?"
helpful = False

Gren supports several different kinds of constants. These are the primitive types:

  • Integers (Int): A whole number. Example: 42.
  • Floating point numbers (Float): An approximation of a fractional number. Example: 5.2.
  • Characters (Char): A single UTF-16 encoded character. Example: 'a'.
  • Strings (String): An array of UTF-16 encoded characters. Example: "test".
  • Booleans (Bool): Either True or False.