Complete the code to declare a function named greet.
fun [1]() { println("Hello!") }
fun.The function name should be greet as specified.
Complete the code to declare a function that returns an Int value 5.
fun getNumber(): [1] { return 5 }
String or other types instead of Int.The function returns an integer, so the return type should be Int.
Fix the error in the function declaration to accept a String parameter named name.
fun greet([1]: String) { println("Hello, $name!") }
The parameter name should be name to match the usage inside the function.
Fill both blanks to declare a function that takes two Int parameters and returns their sum.
fun add([1]: Int, [2]: Int): Int { return a + b }
The parameters should be named a and b to match the return statement.
Fill all three blanks to declare a function that returns a greeting message with the given name.
fun greet([1]: String): [2] { return "Hello, " + [3] }
The function takes a parameter name of type String and returns a String greeting using name.
