More on code comments
As you become more advanced at writing Kotlin programs, the solutions that you use to create your programs will become longer and more complicated. Furthermore, as we will see in later chapters, Kotlin was designed to manage complexity by having us divide up our code into separate classes, usually across multiple files.
Code comments are a part of the Kotlin files that do not have any function in the program execution itself; that is, the compiler ignores them. They serve to help the programmer to document, explain, and clarify their code to make it more understandable to themselves later, or to other programmers who might need to use or change it.
We have already seen a single-line comment:
// this is a comment explaining what is going on
The preceding comment begins with the two forward slash characters, //
. The comment ends at the end of the line. So, anything on that line is for people only, whereas anything on the next line (unless it's another comment) needs to...