mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-07 15:53:18 +00:00
19 lines
282 B
Kotlin
Vendored
19 lines
282 B
Kotlin
Vendored
|
|
inline fun <R, T> foo(x : R?, y : R?, block : (R?) -> T) : T {
|
|
if (x == null) {
|
|
return block(x)
|
|
} else {
|
|
return block(y)
|
|
}
|
|
}
|
|
|
|
fun bar() {
|
|
foo(1, 2) { x -> if (x != null) 1 else 2 }
|
|
}
|
|
|
|
// 0 valueOf
|
|
// 0 Value\s\(\)
|
|
// 0 IFNULL
|
|
// 1 IFNONNULL
|
|
// 1 IF
|