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.
In order to tell the computer that some of the text in our program is only meant for notes (and shouldnβt be executed), we can designate parts of our code as comments. Comments can explain what the code is doing, leave instructions for developers using the code, or add any other useful annotations.
There are two types of code comments in Emojicode:
A single line comment will comment out a single line and is denoted by π
preceding it:
π Prints "hi" π π€hiπ€βοΈ
A π
comments out any code that follows it (until the end of the line), so you can also use one after a line of code:
π π€hiπ€βοΈ π Prints "hi"
A multiline comment will comment out multiple lines and is denoted by ππ
to begin the comment, and ππ
to end the comment:
ππ This is all commented out. None of this is going to run! ππ
Letβs try writing two comments.
Instructions
Somewhere in the program, add a single line comment with todayβs date.
Add a multiline comment that explains how you are feeling.