Let's now discuss some of Kotlin's syntactic rules and coding guidelines:
- Class name: As in Java, class names begin with an uppercase letter. We can create it with a lowercase letter, but it is recommended that we use an uppercase letter, as per the Java coding convention. This is to keep the convention the same when dealing with both Java and Kotlin files.
- Packages: Specify the package at the top of the class. Packages are written in lowercase letters separated by a dot(.):
package org.rao.kotlin.intro
Note that the semicolon is optional in package declarations in Kotlin.
- Imports: The imports should be after the declaration in the class file. If there is no package statement, the import statement should ...