mirror of
https://github.com/CPunch/Cosmo.git
synced 2024-11-14 03:50:04 +00:00
CPunch
c8cae03604
- 'var' has some weird scoping connotations with users of JS. better to change it to 'let', which will decide whether to make the variable a local or a global - 'func' looks visually appealing lol - some minor refactoring done in cparse.c
27 lines
729 B
Plaintext
27 lines
729 B
Plaintext
// just testing continues and breaks
|
|
|
|
for (let x = 0; x < 700; x++) do
|
|
for (let i = 0; true; i++) do
|
|
let str = i .. "." .. x
|
|
if (i == 998) then
|
|
print(i .. " reached")
|
|
break // exits the loop
|
|
end
|
|
|
|
print("for cont- " .. str)
|
|
continue // this really doesn't have much effect since the loop is restarted anyways, but this is just to prove it works as expected
|
|
end
|
|
|
|
// same example as the for loop but done manually using a while loop
|
|
let i = 0
|
|
while true do
|
|
let str = i .. "." .. x
|
|
if (i++ == 998) then
|
|
print("done")
|
|
break
|
|
end
|
|
|
|
print("while cont- " .. str)
|
|
continue
|
|
end
|
|
end |