Skip to Content

Meaningful and motivating: The use of variables in a game project

In this short video, Mitch Resnick of the MIT Scratch Team talks about one way in which learning about variables can be made meaningful for young people.

Variables are a very important mathematical concept and also an important computational concept. Of course, students are already taught about variables in their math classes at school. But many students have a difficult time learning about variables. I think that's at least in part because they don't quite see the usefulness of variables. Of course, they can use a variable to solve a math problem for homework. But it's not something that they can use in their every day life, in a meaningful way.

That changes with Scratch. Scratch provides kids with an opportunity to learn about variables in a meaningful and motivating context, where they really use variables to accomplish something that they really care about.

Let me give you an example. A few years ago I was at one of our Computer Clubhouse after school centers and I saw a 13-year-old boy working on creating his own game, somewhat like the one you see on the screen here. He was able to control a character, in this case it's a fish, that I'm controlling by moving the mouse. If I navigate the right way, I can eat little fish. He was pretty happy with his game, but he wanted to go further. He wanted the game to keep track of the score, so you could see how many little fish had been eaten by the big fish. But he didn't know how to keep score in the game.

Now I saw this as an opportunity to introduce the idea of variables. I showed him how you can choose the category "Variables" and then "Make a variable", we'll call it score. It automatically puts up a display of the value of the variable. It starts out at 0. It also creates some blocks to let you to manipulate the variable. For example, if I pull out the block "change score by 1", when I click on it, the score goes up to 1. Click on it again, the score goes up to 2.

I showed this to him and he immediately saw how he could use this block to keep track of how many fish had been eaten in his game. He took the block and put it in the script right where the big fish eats the little fish. He quickly tried it. Sure enough - every time the big fish eats a little fish, the score goes up by 1.

He was really happy with this result and he'd started to get a better understanding of what variables are about. I think that he really got a deep understanding of variables because he really wanted to make use of it. He was able to start using it for this game and start using it in his other projects.

I think that's one of our overall goals of Scratch. It's not just about variables, but for all types of concepts. We see that kids get a much deeper understanding of the concepts they learn when they are making use of the concepts in a meaningful and motivating way.

Scratch Project: 
Svetlana Pronoza

I showed him how you can choose the category "Variables" and then "Make a variable", we'll call it score

I agree with you. It is the most motivating context.