Have students practice looping through an array in as many ways as possible, such as forwards and backwards, to increase their comfort with array looping.

Like(1889 Likes)
  • When students are provided code, it is crucial they understand the loop bounds when indexing through an array so they can write proper loop bounds themselves.
  • The Java code below demonstrates both forwards and backwards looping.
    int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    for (int i=0; i<arr.length; i++) {

    for (int i=arr.length-1; i>=0; i--) {



  • More complex looping, like in the Java code below that prints every other element of an array, can further students’ understanding of array looping.
    for (int i=0; i<arr.length/2; i=i+2) {


More about this tip

External Source

Leigh Ann Sudol-DeLyser’s notes from 2009 AP CS A exam.