Lesson 0.3: Start Blocks and Events
An event is something a program can notice, such as a run button being pressed. An event handler is the code that begins because that event happened.
In this course, the when program starts block is the main event handler. Pressing Run sends the start event. The runner finds that start block and follows the commands connected under it.
Blocks that are not connected to a start block do not run on their own. This rule helps you tell the difference between code that is part of the program and blocks that are waiting in the workspace.
A larger program can respond to several kinds of events, such as a key press, a timer, or new sensor data. The important question stays the same: what event starts this stack of commands?
Guided practice
Keep one print block connected under when program starts. Place a second print block by itself. Run the program and check which text appears. Then connect the second print block under the first and run again.
Use Step and watch the highlight begin at the start block before moving through the commands. Explain the start event in one sentence using the words event and handler.
Loading the block workspace...
Ready to move on?
Only mark complete if you genuinely understand the material. Your progress will be saved in this browser.
Stuck on this lesson?
Ask about anything on this page. It can see which lesson you have open and which part you are reading.