ccm/tests/loop.ccm

66 lines
642 B
Plaintext

var a = 0
while a < 100
a = a + 1
end
assert_eq (100, a)
var b = 0
var c = 0
var d = 0
while b < 6
c = 0
while c < 7
d = d + 1
c = c + 1
end
b = b + 1
end
assert_eq (d, 42)
var e = 0
var f = 0
while e < 128
e = e + 1
if e % 2 == 0
continue
end
f = f + 1
end
assert_eq (64, f)
var g = 0
var h = 0
var i = 0
while g < 100
h = 0
if g >= 7
break
end
while h < 100
if h >= 6
break
end
h = h + 1
if h % 2 == 0
continue
end
i = i + 1
end
g = g + 1
end
assert_eq (21, i)