The for statement is a maintstream loop controlling statement across most of programming languages. When number of repetition of loop is known, the for loop is the best candidate to be used. It is very similar to that in C or other languages such as JavaScript language

Syntax for FOR statement

    for (initial; count_check; increment)
            // code goes here

Example with a FOR statement


›› go to examples ››