Comments in the Scratch program are adjustable textboxes that can be attached to blocks, or left floating. They can be adjusted horizontally (the text relocating to change the height as well), dragged around the Scripts Area, and deleted. In a survey conducted by the Scratch Team, which tried to identify the top scripts used by Scratchers, the comment block (which was accidentally found by the survey engine due to technical reasons) ranked 10th, being 0.68% of all scripts on the website. This was surprising and encouraging to the Scratch Team.[1]

History

The old comment block from the Scratch 1.2 beta. It can still be found in old Scratch projects that used the block.
The Scratch 1.2 beta introduced a comment block as a Control block that could be placed inside a script as one of its blocks. It made no change to the script, as it only held text — however, newer users grew confused about it, causing it to be removed in the official Scratch 1.2 release.

The offline player will treat the comment block as an obsolete block, and as such, stop the script that contains the comment. This can be a problem for old projects that contain the comment block.

Both the Scratch Team and the Scratch community wanted the ability to add comments to scripts in order to improve their readability. Scratch 1.3 introduced the modern comments that are still used today. Since Scratch 1.4, comments can be stuck to a block so that comments remain attached when a script is dragged around. The font used with the comment block, also used in drop-down menus, was changed to Verdana with Scratch 1.3.

Use

A main use for comments is to explain how a script is working. An example is below:

when flag clicked
switch to costume [costume1 v]//Preparing the project...
set [variable v] to [0]
go to x: (0) y: (0)
forever
if <touching color [#372080]?>//Gameplay.
change [variable v] by (1)
end
if <touching color [#00bb03]?>
change [variable v] by (-1)
end
end

The comments are attached to the blocks with a line a pixel thick, theoretically making it hard to see on this wiki or anywhere else with a white background.

Shapes

The two comment types. The top one is a mini comment and the bottom one is a full comment.
Comments can be shaped into two ways — a full comment or a mini comment. The type can be changed by clicking the gray triangle at the upper-left of a comment.

Mini comments are one line long and hold the amount of characters that will fit on one width of the comment. Full comments display all text entered into it, which can extend infinitely.

The width of comments can be altered by clicking the parallel lines on the right-hand side of the comment, and dragging to the desired width. This can also be extended infinitely, and is particularly useful if the mini comment is too narrow to display a sufficient amount of characters.

Blocks Plugin

To use comments in the Blocks Plugin, simply add "//" after the block to be commented, and add the annotation after that. This syntax is derived from comments in most high-level languages.

References

  1. http://blog.scratch.mit.edu/2011/08/what-42-million-scratch-scripts-look.html