Page 75 - Digicode_AI_class_7
P. 75

What is an Event?

            Event is an action which has happened. You can consider event as a generalization of things on
            which the program responds.
            In programming, an event is an action which occurs as a result of the user or another source, such
            as a mouse click.

            Examples of the events are:

               Clicking and loading the web page on web browser

               Creation of file in a file system
               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.
            What are Collections?

            A collection is a container which groups multiple elements into a single object. Collections are used
            to store, retrieve and manipulate stored data.

            Example of collection:
               Collection of cards
               Telephone directory
            Advantages of collection:
               It groups multiple elements into a common set.
               It increases the performance of the program.
                It increases productivity, which means based on the requirement the size could be get altered
               even after its declaration.
               It consumes less memory.
               It can hold both homogeneous and heterogeneous elements.



                                                                             More on MakeCode Arcade      73
   70   71   72   73   74   75   76   77   78   79   80