Page 115 - CG_v2.1_flipBooks_class_6
P. 115

11  Drag the splash block                                                    12 Type Number
                     from the Game blocks                                                        is even in the
                     category and drop it                                                        message area of
                     inside the if block.                                                        the splash block.


                     13 Drag the splash block                                                     14 Type Number
                     from the Game blocks                                                        is odd in the
                     category and drop it                                                        message area of
                     inside the else block.                                                      the splash block.



                 The output appears on the Game simulator. Change the value of the number variable in the set to
                 block to see more output.































                       Let's REFRESH


                      A variable is a name given to a location in the computer’s memory to store values or data.
                       Each variable in a program must have a unique name; you cannot use the same name for more than
                      one variable.
                      We can create a variable using the Variables block category.
                      The process of assigning a value to a variable is called initialisation.
                       Math blocks are used to perform various mathematical operations and computations in your games
                      and projects, like addition, subtraction, multiplication and division.
                      Logic blocks are used to handle decision-making and control flow in your projects.









                                                                                  More on MakeCode Arcade     113
   110   111   112   113   114   115   116   117   118   119   120