Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions dart/Label with Break.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@


void main() {
outerloop: // This is the label name

for (var i = 0; i < 5; i++) {
print("Innerloop: ${i}");
innerloop:

for (var j = 0; j < 5; j++) {
if (j > 3 ) break ;

// Quit the innermost loop
if (i == 2) break innerloop;

// Do the same thing
if (i == 4) break outerloop;

// Quit the outer loop
print("Innerloop: ${j}");
}
}
}
14 changes: 14 additions & 0 deletions dart/Label with continue.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
void main() {
outerloop: // This is the label name

for (var i = 0; i < 3; i++) {
print("Outerloop:${i}");

for (var j = 0; j < 5; j++) {
if (j == 3){
continue outerloop;
}
print("Innerloop:${j}");
}
}
}