Contents

Loop Errors

Script Breaks

Breaks are used to jump to a different line in your code, or to break out of a block of code.


break;
continue;
break LabelName;
continue LabelName;

Example:


break can be used to break out of a loop.


var text="";
for (i = 0; i < 10; i++) {
if (i == 3) {break;}
text
+= "The number is " + i + "\r\n";
}

continue can be used to jump to the next iteration of a loop.


var text="";
for (i = 0; i <= 10; i++) {
if (i == 3) {continue;}
text
+= "The number is " + i + "\r\n";
}

Loop Errors