Quick Tip: Labeling Loops

Did you know you can label loops in ActionScript 3? Yes, you can! I got inspired by latest tweets referencing source code in image. Lets do some small experiments… Label all of them:

var a:uint, b:uint = 0;
loopA:for(a = 0; a < 10; a++)
    loopB:while(b++ < 100)
        loopC:for each(var c:uint in [0,1,2,3])
            break loopB;

trace(a, b, c); // traces "10 10 0"

Read the rest of this entry »