Sleepzy to Programmer Humor@lemmy.ml · 10 个月前Elvisimagemessage-square35linkfedilinkarrow-up1164arrow-down111
arrow-up1153arrow-down1imageElvisSleepzy to Programmer Humor@lemmy.ml · 10 个月前message-square35linkfedilink
minus-squaredev_null@lemmy.mllinkfedilinkarrow-up4·10 个月前It’s a shorthand for writing this: variable = if (input != null) input else default This is equivalent: variable = input ?: default
minus-squaredev_null@lemmy.mllinkfedilinkarrow-up2·10 个月前It’s in Kotlin and some other languages. C# has it but there it’s actually A ?? B.
It’s a shorthand for writing this:
variable = if (input != null) input else default
This is equivalent:
variable = input ?: default
Huh. Neat feature.
It’s in Kotlin and some other languages. C# has it but there it’s actually
A ?? B
.