Sleepzy@feddit.it to Programmer Humor@lemmy.ml · 2 months agoElvisfeddit.itimagemessage-square35fedilinkarrow-up1162arrow-down110
arrow-up1152arrow-down1imageElvisfeddit.itSleepzy@feddit.it to Programmer Humor@lemmy.ml · 2 months agomessage-square35fedilink
minus-squaredev_null@lemmy.mllinkfedilinkarrow-up4·2 months agoIt’s a shorthand for writing this: variable = if (input != null) input else default This is equivalent: variable = input ?: default
minus-squareAVincentInSpace@pawb.sociallinkfedilinkEnglisharrow-up1·edit-22 months agoHuh. Neat feature.
minus-squaredev_null@lemmy.mllinkfedilinkarrow-up1·edit-22 months agoIt’s in Kotlin and some other languages. C# has it but there is 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 is actually
A ?? B
.