I went to the shop and bought a VARIABLE!
Lesson 3 (Part 2)
By now, you have all used variables. To jog your memory, complete the following mini-quiz before we get into arrays/lists...
Arrays (sometimes called lists) are special types of variables that allow you to store more than one piece of information. Shopping lists and class roles might be two simple uses for arrays. Watch the following video for more information.
Now, we're going to play a game that you might be familiar with, but I bet you never though that you were building up an array or thinking like a computer!
This memory game is called 'I went to the shops and bought....' and it involves students sitting in a circle and listing a new item that they add, plus every other item previous students have listed in order. For instance, the first person might say:
'I went to the shops and bought an apple', and the second one would continue: 'I went to the shops and bought a bike and an apple'.
Spend the next five minutes playing this game.
Arrays often have more than one dimension. For instance, if you need to store map coordinates, you need to record both x and y axes. This time, adapt the game so that it has two dimensions; the type of shop and the item. For instance, the first student might say:
'I went to the fruit shop and bought a watermelon' and the second would continue:
'I went to the service station and bought some petrol, and to the fruit shop and bought a watermelon'.
As a memory game, this is obviously harder than the first version, but give it a go!
This last video is not to be watched in class (it's too long!), but take a look at home if you're interested in finding out more about arrays and how they work with MakeCode.
Now take a look at today's lesson and then continue on your programming adventure with TinkerGen Go Game.