Completing a simple Hello World program

Report a typo

Your current task is to work on a simple Hello World program in Kotlin. The major part of the code is already written, however, there are a few gaps that you need to fill. The first gap is to define an object. Secondly, within the scope of this object, you need to declare a string variable. Lastly, fill the gap for outputting the variable in a line to the console. Can you complete the program and make it print 'Hello, Kotlin!'?

Fill in the gaps with the relevant elements
 main(args: Array<String>) {
    val myObject =  {
         myVariable: String = "Hello, Kotlin!"
        fun printVariable() {
            (myVariable)
        }
    }
    myObject.printVariable()
}
funprintlnobjectvar
___

Create a free account to access the full topic