Ranges

// inclusive range (1 2 3 4 5)
range a = 1..5

// exculsive range (1 2 3 4)
range b = 1...5

// reverse range (5 4 3 2 1)
range c = 5..1

// negative range (-5 -6 -7 -8 -9)
range d = -5...-10

Strings

string a = "Hello"

// index access
// a[1] == "H"

// revese access
// a[-4] == "e"

// range access
// a[1..3] == "Hel"

// reverse range access
// a[5..3] == "oll"

// reverse access
// a[-5..-4] == "He"

Integers

integer a = 23

// integer division
// a / 5 == 4

Decimals

decimal a = 1.6

// division
// a / 1 == 1.6

Booleans

boolean a = true
// a == (3 < 10)
a = 3 - 2 == 1

Lists

When defining as a constant (eg an integer as a constant is just “3″), the actual class of the list is the lowest common denominator. If the list is all integers then the list class will be integer[]. If the list is a mixture of integers and strings then the list type will be object[].

integer[] a = [1, 2, 3]

// can use ranges
integer[] a = [1..3, 5]
// a = [1, 2, 3, 5]

// can use other lists
integer[][] a = [[1,2],[4,2],[6,2]]

// don't have to be the same length
integer[][] a = [[1],[4,2,5],[1,2]]

// concatenation
integer[][] a = [1,2,3]
integer[][] b = [4,5,6]
// a + b == [1,2,3,4,5,6]

Classes

// owners are objects
owner(object) a = integer
integer b = a.alloc().init(4)

Triggers

Triggers can be used to alert an object about a change in environment. They can be hooked to an expression or an event. They have a method that gets called when the trigger gets “fired”.

Pages: 1 2 3 4 5