Page 44 - Ones and Zeros 4 (Student Book)
P. 44

Data and Variables










                                                    data      variable

                                          ‘variables’ block      ‘Sound’ menu






             Let’s Learn

             Data is information stored in a computer. The information we store can be facts
             or figures. The score of a game is an example of data. Data is stored in a computer
             as a variable. Every time you answer correctly, the variable will change, and your score
             gets higher.


             Let’s Practise

             Adding score to the game.

             We’re going to use ‘variables’ block to keep score.

               1    Open Scratch by double-clicking on the
                    ‘Scratch’ shortcut.

               2   Load the project, ‘A Wizard’s Quiz.sb3’.


               3   From the ‘Variables’ menu, click on
                    the button ‘Make a Variable’.

               4   Let’s name this variable, ‘Score’.
                    Then, click ‘OK’.
               5   Add the block named ‘change ‘my
                    variable’ by 1’. Be sure to change
                    the ‘my variable’ selection to ‘Score’.

               6   Drag it under the ‘say ‘Correct’
                    for 2 seconds’ block.

               7   Repeat this for the other ‘say’
                    blocks that have to do with the
                    correct answers only.









               42
   39   40   41   42   43   44   45   46   47   48   49