Encourage students to get the for-loop counter right before adding code inside the for loop this will reduce the amount of time spent troubleshooting for-loops and ensure students are scaffolded well.

  • Students might find it helpful to write out code that loops and prints a certain number of times, before adding in the content of their for loop.

    • Sometimes students may find it boring to focus on just this but it’s a vital topic to understand before moving forward.

  • For instance you might have students get comfortable writing the following code before they add more complicated code inside their for loop.

    for (int i = 0; i < 5; i++) {
        System.out.print (i);
    }

  • This code focuses explicitly on the loop-counter which helps reinforce practice on the loop-counter first.

More about this tip

External Source

Interview with Rachel Menzies.