Repository navigation
Basic Types
Ints are signed 32-bit integers.
1
Numbers are signed 64-bit double precision.
1.234
Kaiper has the null value.
null
Boolean values true and false are present in Kaiper.
true
false
Kaiper supports strings encoded in UTF-8, which are created by writing text between single or double quotes.
Double quoted strings support interpolation, while single quoted strings do not.
"Hello, the value of PI is ${Math.PI}"
'I'm also a valid string, but I can't do interpolation!'
Arrays are denoted by enclosing square brackets in Kaiper. The contents can be of any type.
[1, 2.5, 3, true, "hello", "world"]
# Get index
array[0]
# Set index
array[0] = "Hello"
Dictionaries are Kaiper's maps. The keys and values can be of any type.
["key": "value", 1: 2]
# Get values
map["key"]
map[1]
# Set values
map["key"] = "value"
map[1] = 2
Tuples are like arrays; they can hold any values. They are created by simply joining 2 elements with a comma ,.
1, 2, 3, true
Tuple values can be named. However, you can not mix positional and named tuple pairs.
// Valid
1, 2, 3, a: 4, b: 5
x: 1, y: 2, z: 3
// Invalid
x: 1, 2
Functions are first class constructs in Kaiper. More information on the Functions wiki page.
def(args...) { expr }
def(args...) = expr
def { args... -> expr }
def _ + 0