Page 99 - Digicode_AI_class_6
P. 99

Complete your homework

                 Program End
            Possible combinations of the example 2:
                            Condition 1                          Condition 2                  Decision

               Have you completed your homework?           Is the time past 6 PM?      Should you go to play?

                                Yes                                  Yes                         Yes
                                Yes                                  No                          Yes

                                 No                                  Yes                         Yes

                                 No                                  No                          No
            NOT Operator


            NOT operator is used to reverse or negate a condition.
            In NOT operator:
               If the condition is TRUE, it will return FALSE or No.

               If the condition is FALSE, it will return TRUE or Yes.
            Example 3: You can go to play outside only of you have completed          Leadership & Responsibility
                                                                                      Initiative
            your homework; otherwise, you must stay indoors.
            Condition: Have you completed your homework?
            Decision: Go out to play?
            Answer: You can go to play outside, only if you have completed your homework; otherwise, you
            should not.

            Pseudocode:
               Program Start

               IF NOT (Completed your homework)
               THEN
                       Stay indoors
               ELSE
                       Go out to play
               Program End
            Possible combinations of the example 3:

                  Have you completed your homework                             Go out to play?

                                   Yes                                                No
                                   No                                                Yes


            Relational Operators
            Relational operator checks the value of the two operands.

            Relational operator returns:


                                                                               Using MakeCode Arcade      97
   94   95   96   97   98   99   100   101   102   103   104