if语句

fun foo(param: Int) {
    val result = if (param == 1) {
        "one"
    } else if (param == 2) {
        "two"
    } else {
        "three"
    }
}

if语句的最后一个语句作为其代码块的值返回。

results matching ""

    No results matching ""