Skip to main content
CS Teaching Tips

Main navigation

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

Don’t allow repeat variable names in intro courses to avoid confusion about different variables with the same name.

Share Don’t allow repeat variable names in intro courses to avoid confusion about different variables with the same name. with FacebookShare Don’t allow repeat variable names in intro courses to avoid confusion about different variables with the same name. with Twitter
  • If you try to explain that you can have two variables named the same thing in different parts of your program to introductory students, it’s likely you’ll be met with blank stares.
  • This concept is best left for later courses, or much later in the year, when students have a better understanding of the basics.

More about this tip

Tags

  • CS 1
  • Intro Programming
External Source

Interview with Dani McAvoy

Other Tips By
Other Tips By Dani McAvoy

Similar tips

Spend extra time teaching Big O in intro classes that use Python because the underlying implementation of Python lists is a mystery to students that leads students to believe many operations are constant, O(1), that are not.
Have students find the best method of sorting a group of unknown weights to teach them about sorting algorithms.
Misconception: students develop the habit of putting the type in front of variables; they don’t realize that this creates a new variable resulting in lots of variables with the same name.

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

Privacy Policy