Settings

            

For Loop

For Loop is a bit more complex command. You give it a variable name, its initial value, its end value, and a step (increment). It is the same as if you:


Let's write the same program as before, print first 5 numbers:

We achieved the same result, but with a lot less code. Plus, it is more readable than before!


Nice job! This is the last Intermediate tutorial. You can continue learning with Advanced level tutorials.

CodeExploreLearnLog In