Skip to main content
CS Teaching Tips

Main navigation

  • Browse All Tips
  • Tags
  • 3D
  • About
  • Rate Tips
  • Tip Sheets

Misconception: The update in the index in a for loop (i.e., the third part of the for loop control statement) happens after the all the steps inside of the loop have happened.

Share Misconception: The update in the index in a for loop (i.e., the third part of the for loop control statement) happens after the all the steps inside of the loop have happened. with FacebookShare Misconception: The update in the index in a for loop (i.e., the third part of the for loop control statement) happens after the all the steps inside of the loop have happened. with Twitter
  • Students often incorrectly read straight across the control statement of the for loop and believe the three execute in order to start the loop.
  • The last part of the for loop control statement, updating the index, does not update until after the loop runs through once.

More about this tip

Tags

  • Content Misconceptions
  • CS 1
  • Intro Programming
  • Programming Concepts
External Source

Interview with Dani McAvoy

Other Tips By
Other Tips By Dani McAvoy

Similar tips

Spend extra time covering these three topics students have a really hard time with in Java: references and primitives, inheritance, and nested loops.
Misconception: Students believe that boolean values can only be used in conditionals.
Track the variable values of a recursive function using multiple pieces of paper to form a “stack” so that students can visualize what happens when a method calls itself and how each method call has its own unique variable values.
  • CSTT Facebook
  • CSTT Twitter

For more information or to report a bug, contact us at admin@csteachingtips.org. Built with Bootstrap. Footer Icons by Mohammed Alyousfi. Powered by Drupal.

Privacy Policy

  • National Science Foundation
  • Sage Fox Group
  • Harvey Mudd College