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!

Beginner's Guide to Kotlin