WEEK: 10

Comments

Before we get too far down the road, I want to make sure everyone knows about comments. These are critical when it comes to writing code. They are not only useful to you, but for someone else reading your code. You might end up using comments a lot in the homework this week so I am going to talk about them now.

There are two types of comments. Single-line comments and Multi-line comments.

They look like this.

    // I am a single line comment.  I comment only this line and no other

    /*
        I am a multi-line comment
        I can type on as many lines as I want.
    */

These two comments go inside your .js files and will help you keep things organized. You can say anything you want in your comments to help remind you what is important about a section of code. So, use comments when you can!

See the Pen p5.js Comments by Michael Cassens (@retrog4m3r) on CodePen.


Previous section:
Next section: