Skip to main content
CS Teaching Tips

Main navigation

  • Browse All Tips
  • Tags
  • About
  • Cards
  • Rate Tips
  • Tip Sheets

Demonstrate swapping variables' values by swapping the contents of two cups full of liquid; you need a third cup to swap the liquids just like you need a third, temporary, variable to swap the values.

Share Demonstrate swapping variables' values by swapping the contents of two cups full of liquid; you need a third cup to swap the liquids just like you need a third, temporary, variable to swap the values. with FacebookShare Demonstrate swapping variables' values by swapping the contents of two cups full of liquid; you need a third cup to swap the liquids just like you need a third, temporary, variable to swap the values. with Twitter
  • Student’s often struggle with swapping the values of two variables.
  • Using two cups full of liquid, it’s easier for students to see why you can’t just swap values without a third, temporary container.
  • This method helps students visualize what they need to do and why!

More about this tip

Tags

  • Meaningful and Relevant Content
  • CS 1
  • Intro Programming
  • Programming Concepts
External Source

Interview with Myra Deister

Other Tips By
Other Tips By Myra Deister

Similar tips

Have students trace loops with break statements to reinforce the behavior of break because tracing is a powerful and straight-forward exercise.
Have students create a program in Python that draws a map of the stars in order to gain practice using dictionaries to manipulate real data.
Use Skylit to let students review past APCS free response questions.
  • 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