Reviewing Variables

Change vs. Set

The previous assignment was aimed at getting you comfortable with using variables to store values, giving you power to do things you couldn’t without them. Variables are one of the central concepts in computer science and one of the most powerful tools in a programmer’s toolbox. They will pop up steadily throughout the rest of the course.

These are two blocks that we will be seeing a lot in Scratch programs. Make sure that you are clear on the differences between them.

You can use these two blocks to accomplish the same thing, but it probably makes more sense to use one over the other depending on what you are trying to do.

  • If you are trying to set the value relative to what it already is (such as adding $5 to a bank balance), you will probably be better off using a change block.
  • If you are trying to set it to a totally new, unrelated value (such as resetting a score in a video game), then you will probably want to use a set block.

Consider this:

change and set blocks are analogous to turn [...] degrees and point in direction [...]. How are they similar? Be prepared to discuss your thoughts in class tomorrow.