Syntax
Kotlin Main Function Syntax
In Kotlin, main function: the entry point of a Kotlin program — fun main() {
}
Quick Answer
- Syntax
fun main() {
}
KotlinSyntax
Main Function
Code example
fun main() {
}
The entry point of a Kotlin program.
How to main function in Kotlin
- Open your Kotlin file or editor.
- Copy the example, then replace its sample names and values for your code.
Kotlin Main Function Syntax
Use fun main() {
}.
Related Syntax References
Frequently asked questions
What is the Kotlin syntax for main function?
Use this pattern: fun main() {
}
Can I copy this Kotlin code example?
Yes. Use Copy code and adapt the example to your program.
Is this Kotlin syntax different on Mac or Windows?
No. The language syntax is the same across operating systems.
Official source · How we verify