End of line comments

Top  Previous  Next

Comments may be included on the end of lines containing GAMS code.  This involves both activation and specification.

Activation - while GAMS accommodates such statements it must be told to do so.  This is done by using the command $Oneolcom.
Specification -- end of line comments are set off through the entry of the delimiting character string !! that renders the remaining part of the statement as a comment.
One can change the activating character string using the command $eolcom.

Example:

(commentdol.gms)

$oneolcom

x=x+1;      !! eol comment

x = x    !! eol comment in line that continues on

   +1;

$eolcom &&

x=x+1;      && eol comment with new character

Notes:

Before end of line comments can be used a $oneolcom activating statement must appear.
End of line comments are copied through to the echo print listing on the appropriate lines.
The lines on which end of line comments appear must be fully valid GAMS statements but the comment can appear on intermediate lines of a statement that terminates later.
The ability to add an end of line comment can be terminated by entering the command $Offeolcom.
One can redefine the activating characters from !! to some other choice using the command $Eolcom cc where cc is the new character string delimiting beginning of a comment as illustrated above.