Search⌘ K
AI Features

The main() Function

Explore the role of the main function as the required entry point for Kotlin applications. Learn its simple syntax and how it starts program execution. Understand optional use of command-line arguments. Gain a foundation for writing complete Kotlin programs that run successfully.

We'll cover the following...

Every application requires an entry point where program execution is started. In most languages, including Kotlin, this is called the main function.

Kotlin also allows writing script files (.kts file ending) which don’t require an explicit main function, similar to Bash or Python scripts. When talking about an “application” above, such scripts are excluded.

In fact, even the code listings here on Educative require a main ...