literals
A number of literals are supported:
-
Strings: "This is a string"
-
Ints: 22
-
Float: 8.3
-
Boolean: true/false
-
List: [, , ...]
-
Empty list: List<Int>()
-
Set: {, , ...}
-
Empty set: Set<Int>()
-
Null: null
operators
The following operators are supported:
-
Addition (numeric types) and string concatenation: +
-
Subtraction (numeric types): -
-
Multiplication (numeric types): *
-
Division (numeric types): /
-
Modulus (integer type): %
-
Casting (casts a variable as one of another type): as (example: 8 as Float)
binary operators
-
Equality: ==
-
Inequality: !=
-
Bigger than: >
-
Bigger than or equal to: >=
-
Smaller than: <
-
Smaller than or equal to: <=
-
Instance of: is a (checks if a certain expression is of a certain runtime type)
-
Contained in collection: in (checks if a certain expression is contained in a collection)
-
and: &&
-
or: ||
-
not: !
Example:
if(!(b is a String) && (b in [8, 5] || b + 3 = 7)) {
// ...
}
variables
Variables can be accessed by use of their identifiers and their properties using the . notation. Example: person.lastName
indexed access List elements can be retrieved and assigned using index access syntax:
var a := list[0]; list[2] := "test";