Shorthand Functions

suggest change

If a function contains just one expression, omit the braces and use = instead, as in an assignment. The result of the expression is returned automatically.

fun sayMyName(name: String): String = "Your name is $name"

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents