// This is a single line comment
data="my data" // This is a single line comment too
/* this is line one of a multi-line comment
this is still part of my comment
this is the last part of my comment */
/* this is a multi-line style comment on a single line */
You often see extra asterisks added to multi-line comments to create decorative information boxes, such as:
* My Functions *
Multi-line functions are particularly useful at the beginning of a program or section of a program to describe what the program is intended to do and how it does it.
Comments are used for two purposes. As you write code (or even before you write it!), you should write comments that will allow another person to understand what the program is doing (or supposed to be doing.) Even if you don't expect anyone else to ever read your code, you'll be surprised how much you can forget if you want to make changes after a few weeks or months.
This site needs an editor - click to learn more!
You Should Also Read:
Editor's Picks Articles
Top Ten Articles
Content copyright © 2021 by Julie L Baumler. All rights reserved.
This content was written by Julie L Baumler. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.