Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
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}");
}
}
}
void main() {
var num = 0;
var count = 0;
for(num = 0;num<=20;num++) {
if (num % 2==0) {
continue;
}
count++;
}
print(" The count of odd values between 0 and 20 is: ${count}");
}
void main() {
var i = 1;
while(i<=10) {
if (i % 5 == 0) {
print("The first multiple of 5 between 1 and 10 is : ${i}");
break ;
//exit the loop if the first multiple is found
}
i++;
}
}
void main() {
var a = 12;
var b = 3;
a+=b;
print("a+=b : ${a}");
a = 12; b = 13;
a-=b;
print("a-=b : ${a}");
a = 12; b = 13;
a*=b;
print("a*=b' : ${a}");
a = 12; b = 13;
a/=b;
print("a/=b : ${a}");
a = 12; b = 13;
a%=b;
print("a%=b : ${a}");
}