-
Notifications
You must be signed in to change notification settings - Fork 1
Array
justinmann edited this page Dec 24, 2017
·
4 revisions
Create an array
[1, 2, 3]
["hello", "this", "is", "an", "array"]
[1, "hello"] // Invalid, all elements of an array must be the same type
Get/set to an array
l : [1, 2, 3]
l[0] = 2
a : l[2]
Add to an array
l : [1, 2, 3]
l.add(4)
Iterate over an array
l : [1, 2, 3]
total = 0
l.each((i : 'i32) {
total += i
})