Skip to main content
CS Teaching Tips

Main navigation

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

Misconception: Students think that both the IF and the ELSE cases of a conditional are executed every single time a conditional runs.

Share Misconception: Students think that both the IF and the ELSE cases of a conditional are executed every single time a conditional runs. with FacebookShare Misconception: Students think that both the IF and the ELSE cases of a conditional are executed every single time a conditional runs. with Twitter
  • For example, here is a conditional in Python:
      if ( x<2 ):
        print "This is fun."

      else:

        print "I love CS."

  • Students sometimes think that if x=1, the computer will print "This is fun." then continue to ELSE and print "I love CS."

More about this tip

Tags

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

"Visual program simulation in introductory programming education" by Juha Sorva.

Other Tips By
Other Tips By Juha Sorva

Similar tips

When students are working on projects, especially open-ended ones, resist the urge to intervene. Don’t do the job for them!
Have students implement a simple GeoLocation class in Java that finds the distance between two locations using the Google Maps API to give students an interesting introduction to object-oriented programming.
Organize an activity where students make phone calls to their classmates with the goal of summing the numbers 1 through 6 in order to demonstrate recursion.
  • 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