Page 115 - CodePilot V5.0 C4
P. 115

Create the given script using all the blocks you’ve learned about, then click the   For example, let’s create the given script:
 Green Flag to run it.



 when  clicked
                                                        when   clicked
                          SHORT SIGN
 start sound  Meow
                                                        think  Let’s try arithmetic operator.
 glide  1  secs to  random position
                          To copy a script:             wait  1  seconds
 if  touching color  ?  then  Ctrl + C
                                                        say   45 +  35
 think  Am I touching the star?
 else

 say  I am in space.
                 COMPARISON/RELATIONAL OPERATORS
                 These operators  allow  you  to  compare  the relationship  between  two values or
                 variables.  It  will compare  two  numbers  and  decide  whether it  is  true  or false.
 RAPID RECALL  Tick ( ) if you know this.
                 Comparison operators are used with the if... then block.

 1.  Coding blocks look like puzzle pieces that fit together to make a program.   This block checks if two values are the same. It returns
                                       =  50
 2.  Sound blocks make your projects lively with music and voices.   true if they are equal and false if they are not.
                                                   This block checks if the first number is smaller than
                                       <  50
                                                   the second.

 OPERATOR BLOCKS                                   This block checks if the first number is greater than
                                       >  50
                                                   the second.
 Operators blocks are used for mathematical calculations and logical comparisons.

 They handle things like addition, subtraction, multiplication and division, as well as   For example, let’s create the given script:
 comparing numbers and joining text.

 ARITHMETIC OPERATOR

                                           when   clicked
 Arithmetic operators  are used  to  do  mathematical  calculations  like  addition,
 subtraction, multiplication and division.   if  50 >  40  then
                                             say  True
 +  This block adds two numbers together.  else

                                             say  False
 -  This block subtracts one number from another.



 *  This block multiplies two numbers.
                                   What if you could code your own superpower in Scratch? What would your
                                   superpower be and how would you use it to help others?
 /  This block divides one number by another.





                                                                                        Scratch Coding Adventures  113
   110   111   112   113   114   115   116   117   118   119   120