# Asterisk Project : AEL Loops

Added by mdavenport , edited by mdavenport on Aug 31, 2010

AEL has implementations of 'for' and 'while' loops.

    context loops {
        1 => {
            for (x=0; ${x} < 3; x=${x} + 1) {
                Verbose(x is ${x} !);
            }
        }
        2 => {
            y=10;
            while (${y} >= 0) {
                Verbose(y is ${y} !);
                y=${y}-1;
            }
        }
    }

NOTE: The conditional expression (the "${y} = 0" above) is wrapped in $[ ] so it can be evaluated. NOTE: The for loop test expression (the "$x 3" above) is wrapped in $[ ] so it can be evaluated.