Time for action – adding comments to a script
Let's add a quick comment that annotates the broadcast block in the Happy Birthday sprite's script:
Select the Happy Birthday script. Right-click somewhere in the scripts area and select add comment.
In the yellow box that appears, type the following:
the "hi mom" broadcast signals the second m sprite to start its animation
.Now click on the yellow comment box and drag it to the broadcast (hi mom) block. Then, release the block. This can be tricky, but the goal is to attach the comment to the block. See the following screenshot:
What just happened?
Commenting our code is one of those things that we should always do more often because it helps other people understand our code. And in reality, this can help us understand what we did when we open a project we haven't worked on in months.