runtime mutable global state

This commit is contained in:
2026-07-03 21:48:23 +02:00
parent adf142736c
commit ee41a54e41
11 changed files with 569 additions and 40 deletions
+30
View File
@@ -0,0 +1,30 @@
Point :: struct {
x i32
}
counter int = 0
ratio float = 1
span range = 0..2
point Point = Point { x = 1 }
values [_]mut i32 = [10, 20]
bump func(value @mut i32) void {
value^ += 1
}
main func() i32 {
counter = 10
counter += 5
bump(&counter)
point.x += counter
values[1] = point.x
total i32 = counter + point.x + values[1]
for span |i| {
total += i
}
if ratio == 1.0 {
total += 1
}
return total
}