Labels & breaking nested loops
Në shqip: Etiketat për ciklet e ndërthurura
ShpjegimiSQ
Për të dalë nga dy cikle njëherësh, i vë ciklit të jashtëm një etiketë (jashte:) dhe shkruan break jashte;. Rrallë përdoret, por shmang flamujt e komplikuar.
EnglishEN
To break out of two loops at once, give the outer loop a label (outer:) and write break outer;. Rarely used, but it avoids complicated flags.
Si ta mendosh
Si dalja emergjente që të nxjerr direkt nga ndërtesa, jo vetëm nga dhoma.
Lexoje në anglisht
Like an emergency exit that takes you straight out of the building, not just the room.
Shembull kodijavascript
jashte: for (const r of rreshtat) {
for (const q of r) {
if (q === 0) break jashte;
}
}