Like Java and other alike languages main() function is the point from which kotlin program starts executing.
The basic structure of program is this :
//main function
fun main(){
//body
println("Hello World!")
}
How the code is executed?
Kotlin is a JVM compatible language.
Java Virtual Machine(JVM) is a virtual machine which allows computers or programs which are written in other languages which are also converted to java bytecode.
And JVM compatible language is a language which executer perfectly on JVM. JVM is responsible for loading, verifying and executing the java bytecode.