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 stringHello "!"
Interpolated string
A string can be interpolated too. It starts with $"
(instead of "
) and contains expressions delimited by {
and }
:
$"Hello { $name } !"
Following characters must be escaped (double the character): {
, }
, "
:
$"{{ Hello ""!"" }}"
is string{ Hello "!" }
Note following constructs are not allowed inside an expression:
- List
- Map
- Interpolated string
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 better to format like this:
[ 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 better to format like this:
{ configuration: "Release"
max: 42 }
{ a: 1
b: 2 }