mutable decl syntax change
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
|
||||
main func() i32 {
|
||||
# 1. `break` out of a `while` once i reaches 5.
|
||||
i i32 = 0
|
||||
a i32 = 0
|
||||
i i32 := 0
|
||||
a i32 := 0
|
||||
while i < 100 : i += 1 {
|
||||
if (i == 5) break
|
||||
a += 1
|
||||
@@ -16,7 +16,7 @@ main func() i32 {
|
||||
if (a != 5) return 101
|
||||
|
||||
# 2. `continue` past n == 3 while summing 0..9 (45 - 3 = 42).
|
||||
b i32 = 0
|
||||
b i32 := 0
|
||||
for 0..10 |n| {
|
||||
if (n == 3) continue
|
||||
b = b + n
|
||||
@@ -25,7 +25,7 @@ main func() i32 {
|
||||
|
||||
# 3. Nested loops: the inner `break` exits only the inner loop, so the outer
|
||||
# loop still runs all three iterations (each contributing one y == 0 pass).
|
||||
c i32 = 0
|
||||
c i32 := 0
|
||||
for 0..3 |x| {
|
||||
for 0..3 |y| {
|
||||
if (y == 1) break
|
||||
@@ -38,7 +38,7 @@ main func() i32 {
|
||||
# 4. `continue` on the final element of an inclusive range bounded by the
|
||||
# element type's maximum must exit cleanly, not overflow the increment.
|
||||
hi u8 :: 255
|
||||
d i32 = 0
|
||||
d i32 := 0
|
||||
for 0..=hi |v| {
|
||||
if (v == 255) continue
|
||||
d += 1
|
||||
@@ -47,7 +47,7 @@ main func() i32 {
|
||||
|
||||
# 5. `while true` is exitable via `break` (so it is not an infinite loop and
|
||||
# the code after it is reachable).
|
||||
e i32 = 0
|
||||
e i32 := 0
|
||||
while true {
|
||||
e += 1
|
||||
if (e == 7) break
|
||||
|
||||
Reference in New Issue
Block a user