Let’s have a look at the four things we don’t need in Kotlin.

No semicolon necessary

In Kotlin, a semicolon (;) to terminate a statement is not mandatory.

In contrast to Java and other languages, the Kotlin compiler usually recognizes the end of a statement even without an explicit ;, for example, by a line break.

Note: The general rule in Kotlin is not to use semicolons.

However, two marginal exceptions should be noted.

Multiple expressions in the same line

If we want to note several statements in a single line, they are separated with ;.

Get hands-on with 1400+ tech skills courses.