- A loop is a part of a program that repeats itself.
- There are different types of loops, in this lesson we will just focus on the while loop.
- The while loop tests a condition and if that condition is true it iterates.
- There can be many reasons you would want to use a loop in your program. Most likely you will need a counter to track how many times the loop executes. You can either increment or decrement this value.
- To increment a variable (number):
- To decrement a variable: