Page 77 - TechPluse_C4_Flipbook
P. 77

Once a variable is created you can see some new blocks as shown alongside.

                 The Table below shows the blocks and their functions.



                                                  Declares the value for the variable created



                                                  Changes the value of the variable by a defined number



                                                  Displays variable on the stage



                                                  Does not display variable on the stage


                 The variable created is placed on the stage at a new place. In the blocks area, the variable name

                 is checked by default. Clicking on the check mark will uncheck the variable and remove it from
                 the stage.
                 Aman wants to find the quotient when 12 is divided by 5. The steps to do this are:

                 Step 1    Delete the cat sprite and add a new sprite Abby from the Library.
                 Step 2    Click and Drag from the Events block to the stage.

                 Step 3    From the Variables category, click on Make a Variable button.

                 Step 4    In the Variable Name dialog box, type N1 as the variable name.


















                 Step 5    Click on OK button.
                 Step 6    Repeat steps 3 to 4 to create two more variables, N2 and Quotient.

                 Step 7    Click and drag                         block to Script area.

                 Step 8    Click on the drop-down arrow and select N1.

                 Step 9    Set the value of N1 as 12.

                 Step 10  Repeat Steps 7 to 9 to set the value of N2 as 5.

                 Step 11  Repeat Steps 7 to 9 to use the variable Quotient.



                                                                                               Game on Scratch       75
   72   73   74   75   76   77   78   79   80   81   82