+ 1
What does “fun main (args: <Arrays> Strings)” mean in Kotlin?
I see it every time at the beginning of every Kotlin Code Playground, could anyone explain why it's there or why a Kotlin code won't run without it?
2 Antworten
+ 2
Just to be clear though "no program will run without it" refers to if you are building a program which is meant to be started from that application. So if your learning Kotlin to make android apps you won't have the fun main because that's not where the program starts. In that case you are mearly buildings functions to use in an Android app. Other languages also have the ability to "bootstrap" to other languages and utilize their functions thus main would not be looked for.
+ 1
This is the main function.
The main function is the start point for every Kotlin program / application.
No program will run w/o this function.