Skip to main content
CS Teaching Tips

Main navigation

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

Remind students to match types on both sides of the equations because they often try to combine types when creating variables.

Share Remind students to match types on both sides of the equations because they often try to combine types when creating variables. with FacebookShare Remind students to match types on both sides of the equations because they often try to combine types when creating variables. with Twitter
  • Ints need to be equal to ints, and doubles to doubles.
    • A common error occurs when students try to set an int equal to a string.
      • For example, int num = "2.5";
    • This stems from not fully understanding that the type on the left of an equation has to equal the type on the right of the equation.

More about this tip

Tags

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

Interview with Dani McAvoy

Other Tips By
Other Tips By Dani McAvoy

Similar tips

Have students design a game of Breakout in Java to practice using conditionals and nested for loops.
Have students create a Python program that implements an automated authorship detection algorithm, which gives them an opportunity to practice working with strings, lists, and loops.
Ask questions about what parts of a program change to help students identify times when a variable is needed.
  • 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