Version: 1.1.0

Literals

Literals are the values you can write directly in source.

Essentials

  • Integer and float literals have arbitrary precision until they are stored.
  • String literals support escapes. Triple quotes span lines.
  • True and False are boolean literals.
  • None is the empty optional literal.
  • List and dict displays build collections.

Example

def main():
    var label = "line\nbreak"
    var items = [1, 2, 3]
    print(label, items[0])

Keep in mind

A literal's type is decided by where it is stored. var x = 1 is an Int, even if you later wished it were a float.