@Sleepzy@feddit.it to Programmer Humor@lemmy.ml • 6 months agoElvisfeddit.itimagemessage-square32fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageElvisfeddit.it@Sleepzy@feddit.it to Programmer Humor@lemmy.ml • 6 months agomessage-square32fedilink
minus-squareThe CuuuuubelinkfedilinkEnglish0•6 months agogotacha. i’ve only ever heard them called ternaries. maybe i’m old. maybe i’m too young. definitely one of the two
minus-square@QuazarOmega@lemy.lollinkfedilink0•6 months agoIt specifically refers to this shorthand ?: that works like this: $value = $thing_that_could_be_truthy ?: 'fallback value'; # same as $value = $thing_that_could_be_truthy ? $thing_that_could_be_truthy : 'fallback value'; The condition is also the value if it is truthy
gotacha. i’ve only ever heard them called ternaries. maybe i’m old. maybe i’m too young. definitely one of the two
It specifically refers to this shorthand
?:
that works like this:$value = $thing_that_could_be_truthy ?: 'fallback value'; # same as $value = $thing_that_could_be_truthy ? $thing_that_could_be_truthy : 'fallback value';
The condition is also the value if it is truthy