comments in Scratch

How To Add Comments To Scratch Coding Projects

Teachers, are you assessing your students’ Scratch coding projects? How do you know that they understand the code that they have written? Here’s a quick tip to have your students demonstrate their learning: ask them to write brief comment notes in Scratch. In this way, they will confirm that they recognize the function of the scripts they have created.

What are Comments in Scratch?

In programs such as word processors, adding comments is a quick method to make a short note about a part of a document. Comments are the same in Scratch. They even look similar. Comments appear as small, yellow symbols similar to Post-it notes. They are written by the programmer to describe the function of code to a viewer.

Why Add Comments in Scratch?

When students create Scratch coding projects, teachers want to know that they have not just copied Scratch blocks. It is critical that students know the reason for blocks and their part in the script. This is the only way that they can build on their knowledge, be creative, and apply their skills in future coding assignments. By having to write comments, students must show, explain, and prove that they comprehend the scripts they have made.

Comments can be used in Scratch to:

  • identify the function of each part of the program
  • describe the logic to another programmer
  • divide the code into chunks
  • act as a reminder about how a program works
  • explain a complex part of the code
  • pinpoint a problem area when editing
  • provide details such as programmer name

How to Add Comments in Scratch

  1. Add a comment by right clicking in a blank part of the Code Area or on a particular block.
  2. Select Add Comment.
  3. In the note that appears, type a message.

It’s as simple as that!

3 Types of Comments

1. General Comment to Describe the Program or Many Scripts

Ask students to show their knowledge by explaining a set of scripts. In the example below, the programmer has grouped scripts that organize player controls. Then the programmer added a comment to describe the function of the four scripts.

A comment can explain what action a set of scripts perform.

2. Comment to Explain One Script

A comment can also be used to identify what a set of blocks do. The following comment has been added to the event block to explain the action of the whole script.

This comment describes the action of the entire script.

3. Specific Comment to Identify the Purpose of One Block or Group of Blocks

Comments can tell the viewer about the action of a particular block. It can also be used to describe what a nested group of blocks, such as a loop, does. Here a comment was added to the if-then block to explain, in words, what the action will happen when the if-then condition of sensing a color is met.  

A second comment is added to explain the nested if-then blocks.

Asking your students to write comments in Scratch is a quick, effective assessment tool. When they can explain what they have created and what the blocks do in their own words, they will clearly demonstrate their understanding.

Want to Teach How to Comment?

TechnoRace is a new Scratch project that includes a commenting task. In this project, students become game developers. They build an imaginary world using Scratch coding blocks. Players race against time to collect points in an online rescue mission. Students learn how to code loops, conditionals, and variables to produce a unique game.