Page 65 - 2619_PlusGPT V2.1_C-6
P. 65

Let’s CatCh uP                                                                Critical Thinking

                   Answer the following questions:

                   1.  Which block is used to make the penguin ask question?
                      ___________________________________________________________________________________

                   2.  Which block will you use if you want to move the penguin?
                      ___________________________________________________________________________________

                   3.  What is the another name of C blocks?
                      ___________________________________________________________________________________
                   4.  Which block will you use to make penguin a sound?

                      ___________________________________________________________________________________





                        VARIABLES

                 A program is a group of commands and instructions that tell the computer to carry out a task. In
                 scratch, a program is called a Script. A Script is made up of a number of blocks. So, the blocks are the
                 commands or instructions that we give to the sprite to perform a task.

                 All the numbers, text, date or pictures that we use in a program are called data. We store this data in
                 the computer memory so that we can get information from it later. This data is stored in variables. It
                 is called variable because it does not have a fixed value, its value changes. For example, in the move
                 block, the variable has a value 10 by default. You can modify this value according to your script.


                      Types of Variables

                 Variables can store numbers as well as letters. A variable that stores numbers is called a numeric
                 variable. These numbers are used in calculations. Examples are 48, -986, 12345, etc.

                 A variable that stores letters in the form of strings or characters is called string variable. A string
                 variable can store names, words, sentences, numbers, and enclosed in quotation marks. For
                 example, “Kavita”, “1 am 12 years old” and “12345”. These variables are not used in calculations.


                      Creating Variables in Scratch

                 To create variables in Scratch, follow the given steps:

                 Step 1:   Click on Variables block category. A set of blocks appears in the block palette.

                 Step 2:   Click on Make a Variable block. A New Variable dialog box appears. Type a variable name
                          in the New variable name box.

                 Step 3:   Click on the radio button of either of the options. Click on For all sprites if you want this
                          variable to appear for all the sprites.



                                                                                              Scratch Programming  63
   60   61   62   63   64   65   66   67   68   69   70