The main () function is an entry point for a Kotlin application. A function can be defined as a block of code designed to perform a specific task.
Another form of the main () function adopts a variable number of string arguments.
The print () is a function in Kotlin that prints its argument to the standard output; similarly, println () is another function that prints its argument into the standard output, but it adds a line break to the output.
Both functions (print () and println ()) can be used to print numbers and strings.
Unlike other programming languages such as Java, C ++, and C #, Kotlin statements do not require a semicolon (;) to terminate a statement.
The Kotlin program can be compiled and executed with or without semicolons.
So as a good programming practice, it is not recommended to add a semicolon to the end of a Kotlin statement.
Although the package specification is optional, the Kotlin code is usually defined in the package. If the package is not specified in a source file, its contents will go to the default package.
|