Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 95 - 2609_Logiccode
P. 95

    For example, let’s create the given script:

                         when   clicked                                                         To copy a script:

                         think  Let’s try arithmetic operator.                             Short key

                         wait  1  seconds                                                         Ctrl    +    C

                         say  45 +  35

                     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. Comparison operators
                     are used with the if... then block.

                                                       This block checks if two values are the same. It returns
                                           =  50
                                                       true if they are equal and false if they are not.

                                                       This block checks if the first number is smaller than the
                                           <  50
                                                       second.

                                                       This block checks if the first number is greater than the
                                           >  50
                                                       second.

                     For example, let’s create the given script:

                                               when   clicked

                                               if    50 >  40  then
                                                 say  True
                                               else

                                                 say  False

                                       What if you could code your own superpower in Scratch? What would your
                                       superpower be and how would you use it to help others?

                                                                                             Scratch Coding Adventures  93

| 90 91 92 93 94 95 96 97 98 99 100 |