oday
10/14/2018, 11:16 AMAndreas Sinz
10/14/2018, 11:17 AModay
10/14/2018, 11:18 AModay
10/14/2018, 11:18 AM? go?oday
10/14/2018, 11:18 AMvar myFun: () -> Unit? = {}?Andreas Sinz
10/14/2018, 11:18 AM(() -> Unit)?Andreas Sinz
10/14/2018, 11:18 AModay
10/14/2018, 11:18 AMAndreas Sinz
10/14/2018, 11:19 AMmyFun?.invoke()oday
10/14/2018, 11:19 AModay
10/14/2018, 11:19 AMSiebelsTim
10/14/2018, 11:23 AM{} for the null case might also be an option. I think it makes the code more readable in some situations.oday
10/14/2018, 11:25 AModay
10/14/2018, 11:25 AModay
10/14/2018, 11:26 AMAndreas Sinz
10/14/2018, 11:31 AMif(myFun != { }) myFun() could work, but nothing prevents you from accidentally invoking it. if its nullable, the compiler enforces that you check it firstoday
10/14/2018, 11:32 AMSiebelsTim
10/14/2018, 1:22 PM