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

Misconceptions: Loops can be difficult for students in Scratch Jr.
Misconception: Students get confused with object-oriented programming in Python because function declarations explicitly take self as an argument, but function calls don’t use self as argument.
Show students examples of unreachable code to help them reason about how conditionals are executed.
  • 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