//This is simple Hello world example in Kotlin (using intellij IDEA)
class Main {
fun main (args: Array<String>){
println("sss")
}
}
I expect to print the msg , instead getting the warning
Warning:(5, 15) Kotlin: Parameter 'args' is never used
From Kotlin documentation.
...function called main with one argument called args of the type "array of strings". args will contain the command-line arguments that the program is invoked with...
Also
it can be omitted if your program does not need to accept command-line arguments and you are using Kotlin 1.3:
fun main() {
println("Hello World!")
}
TLDR; If you don't use command-line and your Kotlin version is >= 1.3, you can remove args
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With