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.
Invoking functions
Creating a greeting message function
Report a typo
Fill in the gaps with the relevant elements
hello(name: String): String {
"Hello, $name"
}
fun main() {
val greeting = hello("World")
(greeting)
} ___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.