Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 84 - 2612_Digimind
P. 84

    when   clicked
                                 >  50        Less than                 if    50  >  100  then
                                                                              50
                                                                          say  50 is less than 100

                                                                        when   clicked
                                                                              50
                                = 50          Equals to                 if    50  =  50  then
                                                                          say  Both the 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’.

                            Operator                Meaning                               Examples

                                              Logical and               when   clicked

                                              The result is true if     if    100  <  50  and   100  <  60  then
                                                                              50
                                                                                                50
                                and
                                              both the conditions         say  100 is greater than 50 and 60
                                              are true.

                                              Logical or                when   clicked

                                              The result is             if    100  <  50  or    100  <  200  then
                                                                                                50
                                                                              50
                                 or
                                              true, if one of the         say  100 is either greater than 50 or 200
                                              statements is true.

                                              Logical not

                                              Reverses the              when   clicked
                                              condition, i.e. it’s      if       5050  <  100  then
                              not                                            not
                                              false if the condition
                                                                          say  Reverses the condition
                                              is true and
                                              vice-versa.

                       82   Premium Edition-IV

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