速記功能

如果函式只包含一個表示式,我們可以省略括號括號並使用等號,就像變數賦值一樣。表示式的結果將自動返回。

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