Types and Literals

Types and Literals

Nothing

Value for no value (pun intended). Similar to void or None in other languages.

Literal is nothing.

String

A string is a sequence of characters. A string starts with " and ends with ":

  • "this is a string"
  • ""

Following characters must be escaped (double the character): ":

  • "Hello ""!"" " is string Hello "!"

Strings support interpolation too ! Use ${ <expr> } syntax:

  • "Hello ${ local.name } !"

Note gollowing characters must be escaped (double the character): {, }, ":

  • "{{ Hello ""!"" }}" is string { Hello "!" }

Boolean

Either literal true or false.

Number

A number is a 32 bits signed integer:

  • 42
  • -123456

List

A list is an ordered sequence of values - values can be of different types:

  • [ 1 2 3 ]
  • [ 1 "value" 42]

As Terrabuild does not use comma separator, it’s encouraged to format as follow:

[ 1
  2
  3 ]

[ 1
  "value"
  42 ]

Map

A map is a collection of named values. Name is always an identifier. Values can be of different types.

{ 
  configuration: "Release"
  max: 42
}

{ a: 1 b: 2 }

As Terrabuild does not use comma separator, it’s encouraged to format as follow:

{ configuration: "Release"
  max: 42 }

{ a: 1
  b: 2 }
Last updated on