REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 23-Feb-2009 Edit History  

REBOL 3 Concepts: Scripts: Comments

Pending Revision

This document was written for R2 and has yet to be revised for R3.

Commenting is useful for clarifying the purpose of sections of a script.

Contents

Types of comments

REBOL provides several types of comments:

In headersEvery script begins with a scripts: headers which can provide general information about the script, including its title, purpose, author, and more.
In functionsFunctions often include embedded title comment and argument comments. These are part of the function! specification, and are used for functions like help.
EmbeddedComments can be embedded within code, and will be kept with the code, even when it is loaded.
LexicalLexical comments only appear in the source code and get stripped out when the is loaded.

Lexical comments

A single-line comment is made with a semicolon. Everything following the semicolon to the end of the line is part of the comment:

zertplex: 10   ; set to the highest quality

Embedded comments

You can also use strings for comments. For instance, you can create multi-line comments with a string enclosed in braces:

{
    This is a long multilined comment.
}

This technique of commenting works only when the string is not interpreted as an argument to a function. If you want to make sure that a multi-line comment is recognized as a comment and is not interpreted as code, precede the string with the word comment :

comment {
    This is a long multilined comment.
}

The comment function tells REBOL to ignore the following block or string.

Watch out

String and block comments are actually part of the script block. Care should be taken to avoid placing them in data blocks, because they would appear as part of the data.


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin