Comments

Interspersed throughout a program you can find comments, which is text to explain code to humans and ignored by Red. A comment starts after a semicolon (;at the start or in the middle of a line:

;-- see Chapter03/comments.red:
; single-line comment
print "start" ; comment on a code line

A multiline comment is formed as follows:

comment {
This is a multiline comment.
This explains how this program works.
}

From the next section on, we will show the return value of a word on the same line in a comment starting with ;== like this—;== value. However, == is also the way the REPL shows the return value, so this should be familiar.

Make multiline comments using several single-line comments (Visual Studio Code has a menu-item for this—Edit / Toggle Line Comment) and even use ;-- for a stronger visual clue. Where possible, avoid comments by choosing descriptive names, and use documentation strings (we'll cover these in Chapter 6, Using Functions and Objects) instead of comments.