Creating a greeting message function

Report a typo

Your task is to fill the blanks in the Kotlin code, which is designed to create a greeting message. You will need to define a function that takes a string parameter (name) and returns another string. This function is then invoked in the main function, and the result is printed. The returned string from the function and the print statement in the main function are the blanks you need to fill.

Fill in the gaps with the relevant elements
 hello(name: String): String {
     "Hello, $name"
}

fun main() {
    val greeting = hello("World")
    (greeting)
}
funprintlnreturn
___

Create a free account to access the full topic