louiscad
07/24/2024, 8:35 AMPHondogo
07/24/2024, 10:08 AMPHondogo
07/24/2024, 10:10 AMPHondogo
07/24/2024, 10:14 AMfun test1(v: Int = 1.also { println("!") }) {
}
fun test() {
test1() // will print !
test1(2) // will not print !
}
PHondogo
07/24/2024, 10:23 AMfun test1(x: Int = 12345)
fun test(y: Boolean) {
test1(if (y) 10 else default) // will be good to have this
}
Klitos Kyriacou
07/24/2024, 10:27 AMPHondogo
07/24/2024, 10:27 AMPHondogo
07/24/2024, 10:33 AMfun test1(x: Int = 123)
fun test2(x: Int = test1::x::default) // something like this
damian
07/24/2024, 1:10 PMfun foo(
w: Int,
x: Int = w + 1,
y: Int = x + 1,
z: Int = x + y
) {
println("w: $w, x: $x, y: $y, z: $z")
}
This would make designing a general API to retrieve a default value rather difficult.louiscad
07/24/2024, 1:24 PMPHondogo
07/24/2024, 1:30 PMlouiscad
07/24/2024, 1:42 PM