Description

Comments are a form of internal documentation. They allow you to place remarks in a program, without affecting its execution.

A valid comment statement must begin with either an * (asterisk) or an ! (exclamation mark). Multi-line comment blocks can be created using /* and */.

The exclamation mark (!) will be printed as a full line of asterisks, if you print the program using BLIST. Any characters may be used in a comment statement, including null or blank spaces.

A comment can be written anywhere in a program, except before the first line of a program that begins with Function or Subroutine.

The text of comments does not affect the size of the object code. However, each line of a comment adds one linemark (one character) to the compiled program.

Syntax

*  { characters}!  { characters}
/*  { characters}  */

Single-line Comments

The comment operators * and ! indicate single-line comments. All characters from the comment operator to the end of the physical line are ignored by the compiler.

Comments can be placed on the same physical line as other BASIC+ statements by using a semicolon (;) to separate the two statements. In this case, all characters to the end of the line are ignored, even if there are additional statements separated by a semicolon. For example:

For CTR = 1 To 10 ; * loop through 10 times

Multi-line Comments

You can create comments that span several lines by using the comment operators /* (to open a comment block) and */ (to close the block). Any number of lines can come between the Comment operators. The compiler will ignore all text between the multi-line Comment operators.

Example

/* program FIELD.REPORT
  author:  John Doe
  date:   01/01/89 */
! data (shelf #, type, title, composer, artist)
 
/* All the elements of CUST (I) from 1 to the highest key are written to the output file. */
If C = " " Then Go 3 Else Go 5; * test for spaces
  • No labels