GML Overview: Comments

You can add comments to your programs. Everything on a line after // is not read. You can also make a multi-line comment by placing the text between / * and */. (Colorcoding might not work correctly here! Press F12 to re- colorcode the text if an error occurs.)

Example //This is a comment. //This is also a comment. //This is a comment, but the next line will not be: all.foo; // This is a comment. The next line will have a statement (which will be executed as normal) // and a comment. other.bar ; // Everything from here on will not be executed! /* This is a slightly longer comment */

If you plan on sharing your code with others (whether you're open-sourcing or working in a team), it is a good idea to take the time to comment on what your code does. Even if it's just a three-line description at the beginning of a script that summarizes what the script does, and its parameters, every bit helps.

Even if you don't intend to show anyone else your work, documenting code can be the key to completing big projects. Staring at code you wrote three months ago trying to figure out what the variable "a_2" stands for is not fun and is an easily-avoided hassle if you documented it in the first place.

Comment as you go so you don't have to devote large chunks of time for it.

Previous: Scripts

Back To GML For Non-Programmers