- Kotlin code is usually defined in packages. Package specification is optional: If you don't specify a package in a source file, its content goes to the default package.
- An entry point to a Kotlin application is the
main
function. Since Kotlin 1.3, you can declaremain
without any parameters. The return type is not specified, which means that the function returns nothing. println
writes a line to the standard output. It is imported implicitly. Also note that semicolons are optional.
Example:
val name:String="Kamal"
val Lname:String="Nishad"
fun main(){
println("Hello $name $Lname")
}
OUTPUT: Hello Kamal Nishad
No comments:
Post a Comment