In Kotlin, there are two types of comments: single-line and multi-line comments.
Single-line comments begin with two forward slashes // and they only comment on the line they are on. For example:
// This is a single-line comment
val name = "John" // This is also a single-line comment
Multi-line comments begin with /* and end with */. They can span over multiple lines and can add a description of a block of code. For example:
/* This is a multi-line comment that can explain a block
of code that does something really complicated. */
fun doSomething() {
// Do something here
}
It is considered good programming practice to add comments to explain complex or unclear sections of your code.