Page 110 - KEC Khaitan C4 Flipbook
P. 110

Use  Broadcast  Messages:  Instead  of writing  long and  confusing  scripts, use  the
                      broadcast  [message]  and when I receive  [message]  blocks  to  trigger  events.  This

                      keeps the scripts shorter, cleaner, and easier to manage.
                      Use Looping Blocks: Avoid repeating the same blocks multiple times, as it makes
                      scripts long and confusing. Instead, use repeat, forever, and repeat until blocks to
                      efficiently  repeat  actions.  This keeps  your scripts  organised,  simple,  and easy  to

                      manage.
                      Test the Project: Use the Events block to run your project and see if everything works
                      as expected. If something goes wrong, check each script carefully and test different
                      parts one by one. Debugging helps fix errors and makes your project run smoothly.
                  Let us learn it through a small script.

                  Suppose, you want to check whether a person is a senior citizen or not. To do so create the

                  following script:





















                  But this code does not give an output if the age of the person is less than or equal to
                  60 years because you have used wrong conditional block. For such situations, when two
                  different outputs are to be specified for two conditions, you use the if…then…else block. In
                  this block, if the condition is true, the code inside the if…then section will be activated. If the

                  condition is false, the code inside the else section will be activated.




























                  108   Premium Edition-IV
   105   106   107   108   109   110   111   112   113   114   115