Alexander Maryanovsky
02/19/2022, 1:12 PMfun foo(arg1: Int, arg2: Int = 42){ ... }
fun wrapper(arg1: Int, arg2: Int? = null){
if (arg2 == null)
foo(arg1)
else
foo(arg1, arg2)
}
Sam
02/19/2022, 1:15 PMcallBy
, but I wouldn't recommend that as a solution herenull
, or is that just a placeholder? You could use overloads, if you just need a 1-arg version and a 2-arg version:
fun wrapper(arg1: Int) = foo(arg1)
fun wrapper(arg1: Int, arg2: Int) = foo(arg1, arg2)
ephemient
02/19/2022, 1:17 PMAlexander Maryanovsky
02/19/2022, 1:19 PM