Page 113 - CG_v2.1_flipBooks_class_6
P. 113

The output appears on the Game simulator.


























                 If we change the value of the variable num to -6 in the set to block, no output will be shown because

                 the condition becomes false.
                 Let us create another project to check whether a number is even or odd using the if-then-else block.
                 Follow the given steps to do so:


                                                       3  Drag the set to block and drop
                                                      it inside the on start block.



                                                                                                    4  Type 5 in the
                                                                                                    value box of the
                                                                                                    set to block to
                                                                                                    set the value
                                                                                                    of the number
                                                                                                    variable to 5.





                    1  Click on the
                   Variables blocks
                   category.




                                                    2  Create a variable
                                                   named number.












                                                                                  More on MakeCode Arcade     111
   108   109   110   111   112   113   114   115   116   117   118