NextGen Knowledge Center

for loops

These loops are often distinguished by an explicit loop counter (variable), which lets the body of the for loop (the code that is being repeatedly executed) know about the sequencing of each iteration. for loops are typically used when the number of iterations is known before the loop is entered.

Syntax (for loops)Example
for (index=startValue; endCondition; incIndex) {
    // Code to execute
}
for (var i=0; i<10; i++) {
    logger.info("i = " + i);
}