Complete the code to define the main function in Kotlin.
fun [1]() { println("Hello, Kotlin!") }
The main function in Kotlin must be named main to serve as the program's entry point.
Complete the code to define the main function with command-line arguments.
fun main([1]: Array<String>) { println("Arguments count: ${args.size}") }
The parameter name for command-line arguments is commonly args, but any valid name works. Here, args is used.
Fix the error in the main function declaration.
fun [1](args: Array<String>) { println("Welcome!") }
The main function must be named exactly main with a lowercase 'm' to be recognized as the entry point.
Fill both blanks to create a main function that prints each argument.
fun [1]([2]: Array<String>) { for (arg in [2]) { println(arg) } }
The main function is named main and the parameter for arguments is args, matching the loop variable.
Fill all three blanks to create a main function that prints the number of arguments and the first argument if present.
fun [1]([2]: Array<String>) { println("Number of args: $[3].size") if ([3].isNotEmpty()) { println([3][0]) } }
The main function is named main, the parameter is args, and the size property is accessed on args.