glox/tests/while.lox

35 lines
527 B
Text
Raw Normal View History

2024-10-07 21:47:55 +03:00
var iterator = 100;
{
while (iterator > 0) {
{
print iterator;
iterator = iterator - 2;
}
}
}
{
while (iterator < 100) {
{
2024-10-08 20:32:13 +03:00
{
print iterator;
iterator = iterator + 2;
2024-10-07 21:47:55 +03:00
2024-10-08 20:32:13 +03:00
if (iterator > 50) break;
print "shoud not be printed after 50";
2024-10-07 21:47:55 +03:00
}
2024-10-08 20:32:13 +03:00
print "OUTER also shoud not be printed after 50";
2024-10-07 21:47:55 +03:00
}
}
}
2024-10-08 20:32:13 +03:00
while (iterator < 100) iterator = iterator + 2;
2024-10-07 21:47:55 +03:00
print iterator;