Page 57 - CloudGPT_C7_Flipbook
P. 57

Step 10:  Change the comparison operator to '>=' and '<=', and the value to '5' and '15'















                  Step 11:  When you click on the 'on start' block, the program runs and displays orange as
                            an output. (Explanation: As the value of 'Height' is '10' in the 'set Height' block,

                            now the value is greater than 5 and less than 15, so the 'If' block will run and
                            'Green' color will get displayed as an output.)















                  Step 12: Change the value of 'Height' to  '2':














                  When you click on 'on start' block, the program runs and displays yellow color as an

                  output. (As the value is '2' in the 'set Height' block, now the value is less than 5, so the
                  'IF' condition is not satisfied, then the 'else' block will run and the 'Yellow' color will get
                  displayed as an output.)





                   Well done, by now you have learned to create dynamic background!



                 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.

                                                                                     Control with Conditionals   55
   52   53   54   55   56   57   58   59   60   61   62