Teach while loops before for loops so that for loops can be explained as a specific case of a while loop that organizes all the pieces needed for a while loop using a counter.

  • Show students examples like the one below to illustrate the relationship between these two types of loops.
    • Using colored text over the related parts of code can help students see the relationships between the different parts of the loops.
int count = 1; while(count ≤ 10){ System.out.println(count); count++; } for(int count = 1; count ≤ 10; count++) { System.out.println(count); }
External Source: 

Interview with Dani McAvoy

Other Tips By: