Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 83 - 2607_Trackpad_Pro_5.1_flipbook_C6
P. 83

    Comparison/Relational Operators
                     Scratch has three operators that allow you to compare the relationship between two values or

                     variables. They compare two numbers and return either true or false. Comparison operators are
                     used with the If...Then block.

                                   Blocks                                         Functions

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

                                                          This block  determines  if the first number is less than the
                                      <
                                                          second number.

                                      =                   This block determines if two numbers are equal.

                     Logical Operators

                     Logical operators are used to combine two or more conditions. Logical operators are used when
                     we want to test more than one condition and make a decision. It produces the results by considering
                     if the conditions entered are true or false. In Scratch, there are three logical operators: ‘and’, ‘or’,
                     and ‘not’.

                                   Blocks                                         Functions

                                      and                 This block returns true if both the conditions are true.

                                      or                  This block returns true if one of the conditions is true.

                                                          This block returns true if the condition is false and
                                    not
                                                          vice-versa.

                         Tick ( ) if you know this.

                         ▶    Motion blocks are used to control the movement of a Sprite.

                         ▶    Looks blocks are used to change the Sprite’s costume.

                                                                                                     Blocks in Scratch  81

| 78 79 80 81 82 83 84 85 86 87 88 |