Navigation:  Tutorials > Beginners Guide to Smalltalk > Objects and Messages >


Previous pageReturn to chapter overviewNext page

Comments can be inserted into your Smalltalk code to provide additional information to help the program reader. A comment is simply text that is enclosed within double quotes.

"This is a comment"


Generally, Smalltalk requires fewer comments than often appear in other languages because the program text is very readable. You should only add comments where they significantly enhance the understandability of the code.

Comments can appear anywhere but they must not breakup the fundamental items of the language such as message selectors or numbers. For example:

365 "Days per year" * 24 "Hours per day"


is legal, whereas:

36"Days per year"5 * 2"Hours per day"4


is not. The latter will generate an error from the Dolphin Smalltalk compiler.

Tip: users of other languages will be used to using double quote marks to denote text strings. It is obviously important that you take special note of this difference with Smalltalk: double quotes delimit comments and single quotes delimit literal text strings.