Skip to main content

Expressions

Values

Simple values:

  • Null: null (type is null)
  • Boolean: true, false
  • Integer: 123, 0, -456
  • Text: 'Hello', "World"
  • Byte array: x'1234', x"ABCD"

Text literals may have escape sequences:

  • Standard: \r, \n, \t, \b.
  • Special characters: \", \', \\.
  • Unicode: \u003A.

Operators

Special

  • . - member access: user.name, s.sub(5, 10)
  • () - function call: print('Hello'), value.to_text()
  • [] - element access: values[i]

Comparison

  • ==
  • !=
  • ===
  • !==
  • <
  • >
  • <=
  • >=

Operators == and != compare values. They compare member values recursively for complex types (collections, tuples, structs) and only object IDs for entity values.

Operators === and !== compare references, not values. You can use them only on types: tuple, struct, list, set, map, gtv, and range.

Example:

val x = [1, 2, 3];
val y = list(x);
print(x == y); // true - values are equal
print(x === y); // false - two different objects

Arithmetical

  • +
  • -
  • *
  • /
  • %
  • ++
  • --

Logical

  • and
  • or
  • not

If

You can use the operator if for conditional evaluation:

val max = if (a >= b) a else b;
return max;

Other

  • in - verifies if an element is in a range/set/map
  • not in - verifies if an element isn't in a range/set/map