1 // examples of the basic syntax
3 // numbers are always doubles
7 greeting = "Hello World!"
9 // functions are first class citizens
16 arr = [pi, greeting, nil]
18 //replace the nil element (indices start at 0)
24 // use the size operator to find an arrays length
28 // tables are associative containers that can use any object as key
35 // equivalent to table["e"] = 2.71
37 table.bar = func() { print(this.e, "\n") }
40 // flow control uses C style
43 print("pi is greater than 2\n")
47 print("pi is less or equal 2\n")
53 print(x = square(x) ", ")
57 //no ++ or -- operators (... yet)
58 for(i=0; i<arr.size(); i+=1)
71 // for each on tables has no specific order
78 // iterate over key value pairs
79 for(key, value : table)
81 print(key, " = ", value, ", ")