Comments in code
Sometimes we might want to write a comment in our code– an explanation to a friend or our future selves on what the purpose of some code is.
Perhaps we want to write a note to ourselves to change something later.
Comments work very similarly in different languages so they're pretty easy to read even if you don't understand the programming language or the code itself.
Lua denotes a comment as --
and any text that follows it:
1 + 1
-- This is a code comment
1 + 2
-- This is another line of comments
3 + 4
These comments will be completely ignored by the computer and are meant for the human to read. Comments can also be on the same line as code. The computer will just ignore the rest of the line when it sees a comment starting.
1 + 1 -- This is my comment. This code adds some numbers together in case you didn't know!
You will see comments appear in future example code, so don't let it surprise you!