### How to Write a 'for' Loop?

For a for loop we need a couple of things:

• Initializing block, in which the counting variable is declared (var i) and its initial value is set.
• Condition for repetition (i <= 10).
• Renewing the counter (i++).
• Body of the loop.
for (var i = 0; i < 5; i++;)
{
// body
}


To make it easier we can use a code snippet for a for loop:

• for + [Tab] + [Tab]