Functions

Functions can be applied on values. Functions take a tuple as argument (param1, param2) which can be built from aforementioned primitives.

Boolean

FunctionDescriptionUsageResult
|or operation.true | falsetrue
&and operation.false & truefalse

String

FunctionDescriptionUsageResult
+concatenate two strings"Hello" + "world""Hello world"
trimremove leading and trailing spacestrim(" Hello world ")"Hello world"
upperconvert string to upper caseupper("Hello world")"HELLO WORLD"
lowerconvert string to lower caselower("Hello WORLD")"hello world"
replacereplace in string.replace("Hello world", "world", "Terrabuild")Hello Terrabuild

Number

FunctionDescriptionUsageResult
+add two numbers5 + 27
-substract two numbers5 - 23
*multiply two numbers5 * 210
/divide two numbers6 / 23

List

FunctionDescriptionUsageResult
ItemGet item at position: error if index is not valid[1 2 3].12
TryItemTry get item at position: nothing if index is not valid[1 2 3].?4nothing
CountGet number of element of listcount([1 2 3])3
+Concatenate two lists[1 2 3] + [4 5 6][1 2 3 4 5 6]

Map

FunctionDescriptionUsageResult
ItemGet named item (using identifier): error if index is not valid{ a: 1 b: 2 }.b2
TryItemTry get named item (using identifier): nothing if index is not valid{ a: 1 b: 2 }.?cnothing
CountGet number of element of mapcount({ a: 1 b: 2 })2
+Merge two maps{ a: 1 b: 1} + { b: 2 c: 2}{ a: 1 b: 2 c: 2}

Generic

FunctionDescriptionUsageResult
Nottrue if falsy (nothing or false)!falsetrue
Equalcompares two values for equality"env" = "prod"false
NotEqualcompares two values for inequality"env" != "prod"true
Null-Coalescereturn value or alternate value if falsy (nothing or false)nothing ?? 4242
Ternary Conditionalchecks boolean value and returns truthy or falsy valuenothing ? 42 : 666666
Last updated on