KoalaUnknown@lemmy.world to Programmer Humor@programming.devEnglish · 1 month agoWhat's a readabilitylemmy.worldimagemessage-square45linkfedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageWhat's a readabilitylemmy.worldKoalaUnknown@lemmy.world to Programmer Humor@programming.devEnglish · 1 month agomessage-square45linkfedilink
minus-squareLeFrog@discuss.tchncs.delinkfedilinkarrow-up0·edit-21 month agoRuby has it as well: a ||= b # which means a = a || b # wich is the same as a = b if !a # which rubyists like to write as a = b unless a # or as ternary a = a ? a : b
minus-squareVictor@lemmy.worldlinkfedilinkarrow-up0·1 month agoThat’s way too many ways of doing the same thing, yuck. But you’re saying the idiomatic way is to use unless, rather than the actual operator for this?
Ruby has it as well:
a ||= b # which means a = a || b # wich is the same as a = b if !a # which rubyists like to write as a = b unless a # or as ternary a = a ? a : bThat’s way too many ways of doing the same thing, yuck.
But you’re saying the idiomatic way is to use
unless, rather than the actual operator for this?