So you just finished making the graphic above when you run into a problem. You want to change the color of the yellow circle. The only problem is, you don’t know which fill goes to which group of colors. You could go through every single one and try to remember what order you put the circles in or you could use something called comments.

A comment is something programmers use to make notes about their program. I use it to label pieces of code if it gets really complicated. They are easy to use and come in two forms.

The first type of comment is the single line comment. Simply type // and then your note. This will tell the computer to ignore the rest of the line. If you try and put a comment before a piece of code you want to use, it won’t work. Comments cancel out code too! If you the computer to ignore a line of code, put the comment symbols before it. But if you don’t want it to ignore the code, either put it on the line before or after the code on that line.

The second type of comment is the multiple line comment. This one could be used if you wanted to ignore a function, which we will get into down the road or a chunk of code at one time. To use this comment, put a /* right in front of the code and a */ right after it. So if you wanted to ignore the group of blue circles in the graphic above, you would put a /* in front of the first ellipse and a */ after the last ellipse.

Here are some examples of comments:

Comments are a great way to label and make notes about your code. Try to have comments in all of your code to make it easier to understand for later and anyone you share it with. Comments are also good if you want to see what a graphic looks like without a part or section, but don’t want to delete it.

Leave a Reply

Your email address will not be published. Required fields are marked *