In this exercise we will use the Open Roberta editor. (Make sure you have this image in the upper right corner of your programming environment.) The editor can be found on our website at the top of the navigation bar: Let’s start - Editor.
FIRST STEPS: VARIABLE
In the NEPO editor, a variable is a placeholder for a number, a string, a color or an image. This means that the variable does not have to have the same value throughout the entire program.
As in a football match, where the number of goals scored during the match can change, the value of a variable can also change during a running program.
By clicking on the + in the start block, you create a new variable. Now you can determine the name, type and starting value. In the drop-down menu Variable, you can find a separate block for each variable, which you can use to display its value on the LED grid of Calliope mini.
To change the value of the variable you need the set item to block from the Variable menu. The value of the variable is changed to the number, string, color etc. behind the set item to block.
By combining what you have learned so far, you can program a simple score counter:
When button A is pressed, the number of goals variable is increased by one numerical value and then displayed.