By Wallace Wang

Part of Beginning Programming All-In-One For Dummies Cheat Sheet

Programs can automatically repeat subroutines and subprograms based on these looping statements. They can repeat a number of times, count a set of items and repeat for each item, or repeat as long as an attribute is true or false.

For variable = startvalue to endvalue

for (initial variable value, final value, increment) { commands; }
while (condition) { commands; }
do { commands; } while (condition);