Source comments
The --
, #
and { }
characters can be
used to add source comments.
For clarity and to simplify program maintenance, it is recommended that you document your code by including comments in your source files.
A source comment is text in the source code to assist human readers, but which BDL ignores.
You can use comment indicators during development to disable instruction temporarily, without removing them from your source code modules.
A source comment can be specified by any of the following:
- A pair of minus signs (
--
) indicates a comment that terminates at the end of the current line. This comment indicator conforms to the ANSI standard for SQL. - The hash character (
#
) indicates a comment that terminates at the end of the current line. - A starting left-brace (
{
) starts a comment. It can be followed by any character (including line breaks). The comment ends when the closing right-brace (}
) symbol is found.
MAIN
-- DISPLAY "This line will be ignored."
# DISPLAY "This line will be ignored."
{
DISPLAY "This line will be ignored."
DISPLAY "This line will be ignored."
}
DISPLAY "Hello, World"
END MAIN
Within a quoted string, the compiler interprets comment indicators as literal characters, rather than as comment indicators.
You cannot use curly brakets ( { }
) to nest comments
within comments.
Comments cannot appear in the form section defining a layout grid,
such as SCREEN
, TABLE
, TREE
,
or GRID
.
The #
symbol cannot indicate comments in an SQL
statement block nor in the text of a prepared statement.
You cannot specify consecutive minus signs ( --
)
in arithmetic expressions, as BDL interprets what follows as a comment.
Instead, use a blank space or parentheses to separate consecutive
arithmetic minus signs.
Do not follow the --
comment indicator with the
hash character (#
), unless you intend to compile the same
source file with the Informix®
4GL product.
The --#
specific comment indicator is used to distinguish Informix 4GL code from Genero
BDL code. This conditional code compilation technique can be inverted
by enclosing code blocks between --#{
and --#}
comments:
MAIN
--# DISPLAY "Ignored by I4GL, but compiled with BDL."
--#{
DISPLAY "Ignored by BDL, but compiled with I4GL."
--#}
END MAIN
- Code lines starting with
--#
are compiled with Genero BDL, but ignored by Informix 4GL. - Code blocks surrounded with
--#{
and--#}
are compiled with Informix 4GL, but ignored by Genero BDL.