Page 55 - Touchcode_C7_Flipbook
P. 55

Webcam or microphone receiving sensory input
                    Incoming network traffic
                    Typing on keyboard
                    Timer

                    In mobile apps, the events that happen are the results of the user doing something (on
                     a click of button the orientation of the phone screen changes)

                 What are Event Handlers?

                 Event handler is a block of code which  get executed when  the event occurs and it is
                 associated with the event.

                 Examples of Event Handlers:

                    In MakeCode Arcade, you display message by using ‘splash’ block . ‘splash’ block will get
                     execute when you click on ‘start the simulator’ button. In this ‘start the simulator’ button
                     is an event handler.

                    When you click "send" for a text message, it sends the message and makes a sound.
                    When you purchase an app from an app store, the phone asks for a password.

                    When you click an icon for an app, the app opens.

                   Coding           uiz   02                                                          Critical Thinking
                                                                                                       Critical Thinking


                    Give one word answer to the following questions.

                    a.  Name an action on which the program responds.                               .......................

                    b.  When does the event handler gets executed?                                   .......................






                       At a Glance
                       Function is a block of code which is made up of a set of steps that results in a single specific
                       action.

                       Function parameters are the names listed in the function definition and Function arguments
                       are the real values passed to (and received by) the function.
                       Sorting is the process of arranging data into meaningful order so that you can analyze it
                       more effectively.
                       An event is something that happens.

                       An event handler gets executed, when that event occurs.





                                                                                           Fun with Functions    53
   50   51   52   53   54   55   56   57   58   59   60