Kotlin: basics of functions
Example:
fun greet(name: String): String {
return "Hello, $name!"
}
Functions in Kotlin can be declared at the top level.
Solution:
print(greet("John"))
// Outputs: Hello, John!
Example: Solution:Kotlin: basics of functions
Functions in Kotlin can be declared at the top level.
fun greet(name: String): String {
return "Hello, $name!"
}
print(greet("John"))
// Outputs: Hello, John!