Our own code can quickly become difficult to understand when we return to it — sometimes only a few hours later! For this reason, it’s often useful to leave a note or reminder in our code for our future selves or other developers.

Comments can explain what the code is doing, leave instructions for developers using the code, or add any other useful annotations.

A single line comment will comment out a single line and is denoted by two dashes -- preceding it:

-- Start the program by greeting the world! Prints "hi" print("hi")

You can also use a single line comment after a line of code:

print("hi") -- Prints "hi"



Let’s practice adding a comment.

Create a single line comment with -- followed by your favorite emoji.

And then type the following:


What do you think this program will output?

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?