Does anyone know how to stop a script from running any further if a match is found to an If statement? For example, suppose your script said:
if (a < 10) document.write (“Less than 10”);
if (a <100) document.write (“Less than 100”);
if (a < 1000) document.write (“Less than 1000”);
But you only want it to write ONE statement, whichever one it hits first, not all of them.
[FONT=Courier New]if (a < 10) {
document.write (“Less than 10”);
break;}
if (a <100) {
document.write (“Less than 100”);
break;}
if (a < 1000) {
document.write (“Less than 1000”);
break;}[/FONT]
But of course break only works inside loops.
I know you could do this in a switch, but I’m wondering if it’s possible in an IF statement.
Thank you!