Game Development Reference
Adding comments to your code
When you're writing a program, it is often useful to write a short note about what a particular section
of code does. This is especially helpful if you've solved a complex programming problem that you're
not certain you'll actually understand the next time you look at it. It also helps other people who
might be looking at your code to understand it better.
There are two ways to add comments to your code. The first is by using two forward slashes:
Any text you add on the same line after these forward slashes will not be interpreted by AS.30 as
programming code. You can write anything you like, and the AS3.0 compiler will ignore it when your
program runs. Here's an example:
Sometimes you might want to write a comment that contains more text than you can easily fit on one
line. You can do this by creating a multiline comment. Multiline comments look like this:
Multiline comments start with the character sequence +& and end with the character sequence &+. You
can write anything you like between them, over any number of lines.
In addition to leaving notes to yourself, comments are especially useful for disabling sections of code
if you want to test how your program behaves without them.
8. To get used to using comments, add one to the Hello World program. Modify your code with
the following line in bold: