Page 160 - Learn To Program With Scratch
P. 160


                                                              x ≥10

                                                8   9  10  11  12  13





                                          x <10                                 x >10
                             8   9  10  11  12  13                8   9   10  11  12  13
                                  x is not <10                                  x = 10

                             8   9  10  11  12  13                8   9   10  11  12  13
                                                                     x > 10 or x = 10

                                                                  8   9   10  11  12  13
                                                                            

                         Figure 6-15: Two ways to implement the inequality x ≥ 10

                             The examples provided in Table 6-9 demonstrate how to use Scratch’s
                         relational and logical operators to express inequalities that contain the ≥
                         and the ≤ operators.


                         Table 6-9: Examples of Testing Inequalities
                          Expression       Implementation Using Logical Operators
                          x ≥ 10

                          x ≥ 10

                          x ≤ 10

                          x ≤ 10

                          10 ≤ x ≤20


                          10 ≤ x ≤20


                             We’ve explored several Scratch concepts in this chapter so far, includ-
                         ing comparisons, conditional statements, and logical operators. Now, let’s
                         use that knowledge to create some fun and useful applications.







           138   Chapter 6
                                           www.it-ebooks.info
   155   156   157   158   159   160   161   162   163   164   165