Page 100 - Digicode_AI_class_6
P. 100

1, if the value is true.

               0, if the value is false.

            Types of relational operators:


               Symbol              Operator                          Description                   Example

                 ==       Equal to                     a is equal to b.                             (a == b)


                  !=      Not equal to                 a is not equal to b.                         (a != b)


                  >       Greater than                 a is greater than b.                          (a > b)


                  <       Less than                    a is less than b.                             (a < b)


                 >=       Greater than or equal to     a is greater than or equal to b.             (a >= b)


                 <=       Less than or equal to        a is less than or equal to b.                (a <= b)



            Nested Conditional Statements

            You may come across complex scenarios in using a single if-else loop might not be enough. In that
            case you need to use nested conditional statement.
            If there is another if-else construct within the if block or the else block, this is called nesting or
            nested if-else.

            Example 1:  To check if a number is divisible by 2 or 3 or by both 2
                                                                                      Interdisciplinary Learning
            and 3.
            Solution:
            Change the 'Number' to '15', in 'set Number' block, and click on 'on start' block, the output will be:





























                 98    DigiCode AI-VI
   95   96   97   98   99   100   101   102   103   104   105