Single line comments

Top  Previous  Next

Users may insert a single line comment (or a group thereof) on any line by placing an asterisk in column 1 followed by any text whatsoever.  The commented text is completely ignored by the GAMS compiler.  It can contain GAMS reserved words, messages or any other content.

Uses can cause GAMS to recognize a character other than an asterisk as the column 1 delimiter.  This is done by using the $ command $Comment c where the character c replaces * as the comment delimiter.  For example

 

$comment !

 

changes the character to a !.  An example follows and is in commentdol.gms

 

*normal comment

*next line is deactivated GAMS statement

*  x=sum(I,z(i));

$comment !

!comment with new character

Notes:

Comments may be intermixed with other GAMS instructions and may be used anywhere in the GAMS code.
The * or other character must appear in column 1 or it (the *) will be treated as a multiplication symbol.
The character used in redefinition of the * comment identifier must be chosen carefully as that character is thereafter prohibited from ever appearing in column 1.
A multiplication symbol can never appear in column 1 while * is the comment beginning character.
One line comments appear in the echo print as numbered lines.