 Let's learn about variables. Variables are the bread and butter of programs. Without them, it's hard to make sense of the countless words and numbers we use to make things fly, run, speak, fall and dance. In this tutorial, we'll show you how to use variables in co-blocks and the magic you can create with them. To create a variable in co-blocks, open the Data Variables category in the co-blocks toolbox. Then, drag and drop the Set Variable block into your workspace. See the default variable named MyVar? You'll be able to change it to one that suits your needs. Now that you've defined your first variable, let's count some numbers. In the Values category, you'll find expression blocks to feed our variable with. We stored a number in our variable. To use it, we place a statement block such as the item say block and place our variable expression block inside. You can update the value a variable block holds by using the change variable buy block. Let's have our item count how many times it was clicked. To do this, use the when item is clicked block and place the change variable buy block inside. Make it count up one with each click. Place the item say block inside so that our character will tell us the value of the variable at each click. Let's code a quick example with a locked door. To unlock it, you need to collect an object first. First, let's add a door and a key to our scene. Then let's open the Coding window. First, we define the variable key collected and set it to false. Now we create click events for each object or item. Let's start with the key. When the key is clicked, we set the variable key collected to true and remove the key. Let's now add the event for the door. To check the status of the variable, we need an if block from the control category. When the door is clicked, we check the key collected variable. If it's false, because we haven't picked up the key yet, the door will tell us that it is closed. If it's true, because we picked up the key, the door will open. That's it! Hit play to test what you programmed. Watch our other tutorials to learn more about coding in Cospaces EDU.