Pages: 1 2 3 4 5 6

Clumpy Usage Guide

Labels

Use the label() method to label the next loop. Pass the name of a label to break_loop() or continue_loop() to break or continue the loop with that label.

var i, j;
    
clumpy.
label('myLabel').
for_loop(
    function () { i = 0; },
    function () { return i < 100000; },
    function () { i++; },
    function () {
        clumpy.
        for_loop(
            function () { j = 0; },
            function () { return j < 5; },
            function () { j++; },
            function () {
                if (j % 10 === 0) {
                    return clumpy.
                    continue_loop('myLabel');
                }
                if (isSpecial(j)) {
                    return clumpy.
                    break_loop('myLabel');
                }
                // statements
            }
        ).
        once(function () {
            // statements
        });
    }
);

That’s it for the guide. There are a few other methods and features that it hasn’t covered, but these are the basics. The other methods are explained in the reference.

© Thomas Peri