JavaScript

Labels and Break

function testbreak(){
 outerloop:
        for (var i = 0; i < 10; i++){
        innerloop:
                for(var j = 0; j< 10; j++){
                        if (j > 3) break;
                        if (i == 2) break innerloop;
                        if (i == 3) break outerloop;
                        alert("i=" + i + " j=" + j);
                }
        }
        alert("Final i=" + i + " j=" + j);
}

testbreak()

José M. Vidal .

30 of 65