What are events on MakeCode?
An event in computer science is an action or occurrence that is detected by a computer. For example, when someone clicks the button on their mouse, it generates a “mouse click event” for the computer.
An event handler is code that is associated with a particular event, such as “button A pressed”. You create (or register) the association between an event and an event handler by calling a function named “on “. After registering an event handler with an event, then whenever that event occurs, the event handler code executes.