Arrays

Wikipedia: Array
In Tengo, an array is a numbered sequence of elements of any type.

fmt := import("fmt")
fmt.println("len: ", len(a))
b := [1, 2, 3, 4, 5]
fmt.println("dcl: ", b)
c := [1, "two", 3.0, true]
fmt.println("mix: ", c)
twoD := [
    [0, 1, 2],
    [1, 2, 3]
]
fmt.println("2d: ", twoD)

try it

emp: [0, 0, 0, 0, 0]
set: [0, 0, 0, 0, 100]
get: 100
len: 5
dcl: [1, 2, 3, 4, 5]
mix: [1, "two", 3, true]
2d: [[0, 1, 2], [1, 2, 3]]
loading…