2024-06-12 11:46:11 +02:00
|
|
|
print('-- test while loop --')
|
2024-06-07 11:37:53 +02:00
|
|
|
{
|
2024-06-12 11:46:11 +02:00
|
|
|
let i := 0
|
2024-06-07 11:37:53 +02:00
|
|
|
while (i < 3) {
|
2024-06-12 11:46:11 +02:00
|
|
|
i := i + 1
|
|
|
|
print(i)
|
2024-06-07 11:37:53 +02:00
|
|
|
}
|
2024-06-12 11:46:11 +02:00
|
|
|
print(i)
|
2024-06-07 11:37:53 +02:00
|
|
|
}
|
2024-06-13 18:10:37 +02:00
|
|
|
|
|
|
|
print('-- test for loop --')
|
|
|
|
{
|
|
|
|
for (let i := 0; i < 3; i := i + 1) {
|
|
|
|
print(i) -- prints 3 times
|
|
|
|
}
|
|
|
|
print(i) -- global does not print
|
|
|
|
}
|
|
|
|
|
|
|
|
print('-- test emptier for loop --')
|
|
|
|
{
|
|
|
|
let i := 0;
|
|
|
|
for (;i < 3;) {
|
|
|
|
print('woo')
|
|
|
|
i := i + 1;
|
|
|
|
}
|
|
|
|
print('hoo')
|
|
|
|
}
|