Initiation au code – Les variables
VARIABLE SAVES THE PARTY
Consider this: it’s your school friend’s birthday, and she has invited the entire class to her grand bungalow for dinner. There are more than 10 different types of dishes – three different types of pizzas, three different kinds of pasta, and more than five different types of soups.
Your friend’s mother starts by serving the soup in small bowls.

Once everybody has had the soup, she brings in the pizza next. As everybody talks joyfully and relishes the pizza, she decides to get the pasta ready. But wait! She realises that all the bowls are dirty, and she doesn’t have anything to serve the pasta in!

She is, however, the female Sherlock Holmes, and she solves the problem immediately. Do you know how?
She realizes that even though she doesn’t have clean bowls, she has enough time to clean the dirty ones, from which everybody had soup. She washes them at super fast speed and finishes the work by the time everybody finishes their pizza slices. Day saved!
The bowls at the dinner were used for serving to different things. In computer programming terms, they will be known as variables. So, what is a variable?
A variable is something that can take or store different values as the program is executed. Just as the same bowl is used to store different things, a variable is used to store different values such as numbers, or words.
How to create a variable?
The good thing about variables, unlike blocks (there is a possibility to create them as well), is that you create them and give them the names of your choice. In PictoBlox, you can create variables using the Variables palette. Let’s try creating one.
- Open PictoBlox. You’ll again see Mr. Panda standing on the stage. Tobi is the default sprite, i.e. every time you open PictoBlox, he will be there, smiling at you from the stage. Now let’s get back to our work. Go to the Block palette and click on the Variables palette.
- You’ll see an option, Make a Variable. Click on Make a Variable.
- A small dialogue box will appear in the center of the screen asking for the variable name; give it any name of your choice.
- Click OK.
