Code comments
The Swift compiler generates executable code from your source code. To accomplish this, it uses a detailed set of rules you will learn about in this book. Sometimes these details can obscure the big picture of why you wrote your code a certain way or even what problem you are solving. To prevent this, it’s good to document what you wrote so that the next human who passes by will be able to make sense of your work. That next human, after all, may be a future you.
Swift, like most other programming languages, allows you to document your code through the use of what are called comments. These allow you to write any text directly along side your code which is ignored by the compiler.
The first way to write a comment is like so:
// This is a comment. It is not executed.
This is a single line comment. You could stack these up like so to allow you to write paragraphs:
// This is also a comment.
// Over multiple lines.
However, there is a better way to write comments which span multiple lines. Like so:
/* This is also a comment.
Over many.. many...
many lines. */
This is a multi-line comment. The start is denoted by / and the end is denoted by /. Simple!
You should use code comments where necessary to document your code, explain your reasoning, or simply to leave jokes for your colleagues :].