Reputation: 75
what's the difference between this two types of main function in kotlin
fun main(args: Array<String>) {
print("Hello World!")
}
and
fun main() {
print("Hello World!")
}
Upvotes: 0
Views: 89
Reputation: 18538
The syntax with the args is used to pass the parameters to the module from command line interface or from outside program. If you don't need it, you can omit it.
If you are getting started with kotlin I strongly recommend you to look at kotlin official website.
Upvotes: 2
Reputation: 7622
With the first option you could pass arguments when running your program
Upvotes: 1