What Do Comments Look Like?

Well, they’re green aren’t they? At least they are for me.

C comments come in blocks between /* and */ and can span any number of lines. C++, C99, C#, and Java add the single line comment that follows //. Other languages provide similar block and line comment facilities, but with different syntaxes.

Again, this is elementary subject matter. But the different comment markers are often used in subtly different ways. We’ll see examples as we go along. However, any commenting scheme that makes cute use of subtle syntax differentiations should be viewed warily.

Get Code Craft now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.