 Here's a program that calculates the sum of squares from 0 up to 9 by using a counter variable that increases by 1 every time it goes through the loop. This sort of counting loop is very common. So common, in fact, that we have a shorthand for it in Java. The FOR loop. You can think of a FOR loop as combining the elements of a while. The initialization of the loop control variable. The loop condition. And the action that changes the loop variable. Here are the names we use for the parts of a FOR loop. The initial action. The loop continuation condition. And the action after each iteration. For historical reasons, namely a language called FORTRAN, you will often see people using single litter variables like I, J, and K as counter variables rather than words like COUNT. Here's the code in a program that lets the user select the limit for the COUNT. And here's the FOR loop. This is the initialization. COUNT starts as 1. We continue as long as the COUNT is less than or equal to N. And after each trip through the loop, we increment the COUNTER. And inside the loop, we square the COUNT and add it to the sum of squares replacing the old value. Let's run the program to see that it does what we want. If we want the sum of squares from 1 to 5, that's 55. The sum of squares up to and including 10 is 385. There's no law that says a loop has to count upwards. In this code, the COUNTER variable I starts at 5, tests to see if it is greater than 0, and subtracts 1 as its action. There's also no law that says you have to count by 1. In this code, the COUNTER variable starts at 0, continues as long as it's less than 10, and after each trip through the loop, adds 2 to the COUNTER instead of 1. But most of the time, your loops will count up by 1. The important thing to remember about a FOR loop is that it has three parts. The initial action, the loop continuation condition, and the action after each iteration.