saqut-compiler/tests/golden/loops/nested_break.sqt

22 lines
550 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// İç içe döngü: içteki break sadece içteki döngüyü etkiler.
// Döngü bağlamı yığınının doğru çalıştığını kanıtlar.
//
// Beklenen: her dış iterasyonda j=1 yazdırılır, j=2'de inner break.
// Dış döngü i=1,2,3 boyunca devam eder — inner break dışarıya sızmaz.
int main() {
int i = 1;
while (i <= 3) {
int j = 1;
while (j <= 3) {
if (j == 2) { break; }
print(i);
print(j);
j = j + 1;
}
i = i + 1;
}
return 0;
}