Previous: Operators and Delimiters To the Table of Content Next: Constants

- 2.2.4 -
TMT Pascal Language Description
Pascal Language Structure

Program Comments

A good programmer knows that comments within a source file can be very helpful. Comments are delimited by “{“ and “}” or “(*” and “*)”. All comments are ignored by TMT Pascal during compilation. Comments cannot contain nested comments that use the same delimiters. Below are examples of traditional Pascal comments:
{ This is a comment }
(* Another comment *)
(* This comment is { nested } *)
{ Another (* nested *) comment }
(* An invalid (* comment *)
In addition to traditional comments, TMT Pascal supports C/C++ and Ada-style end-line comments. These begin with a double hyphen and span until the end of the line. For example:
/* This is C-style comment */
  Space := ' ';  -- initialize filler char
  FillChar(Ptr ($A0000), 64000, 0);  // clear VGA video memory
Remarks:
A comment that contains the dollar sign ($) immediately after opening {, (* or /* is a compiler directive. A mnemonic of the compiler command follows the $ character.

Starting from version 3.0, TMT Pascal is not support Ada-style comments by default. We thinking to completely remove support for Ada-style comments in future and recommend you to replace all Ada-style comments in your programs by traditional Pascal or C/C++ styled comments. Use {$AC+} compiler switch, if you want to compile old sources with TMT Pascal 3.0 and higher (see $AC: Ada-Style Comments Switch.


Previous: Operators and Delimiters To the Table of Content Next: Constants
Operators and Delimiters Table of Content Constants

- 2.2.4 -