Page History

ラムダ式

yhornisse edited this page on 21 Dec 2020

Clone this wiki locally
>>> fun hoge(v:(Int, Int) -> Int) : Int = v(3, 4)
>>> hoge({x:Int, y:Int -> x * y})
res44: kotlin.Int = 12
>>>
>>> fun hoge(v:()-> Int) : Int = v()
>>> hoge({ -> 3})
res50: kotlin.Int = 3
>>>
>>> fun hoge(v:()-> Unit) { v() }
>>> hoge({ -> println("hoge")})
hoge
>>>