mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
17 lines
324 B
Python
17 lines
324 B
Python
v as Array!(Nat, _) = ![]
|
|
for! 0..<10, i =>
|
|
v.push! i
|
|
|
|
assert v[0] == 0
|
|
assert v == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
log sum v
|
|
|
|
iv: Array!(Int, _) = ![1]
|
|
iv.push! 2
|
|
iv: Array!(Int, 2)
|
|
|
|
v2 = ![1, 1, 1]
|
|
v2.update!((x: [{1}; _]) -> x + [1])
|
|
|
|
v3 as Array!(Int, _) = ![1, 2, 3]
|
|
v3.update!((x: [Int; _]) -> x + [1] as [Int; _])
|