tfm@europe.pub to Programmer Humor@programming.devEnglish · 3 months agoTrue crimeeurope.pubexternal-linkmessage-square50fedilinkarrow-up1168arrow-down19
arrow-up1159arrow-down1external-linkTrue crimeeurope.pubtfm@europe.pub to Programmer Humor@programming.devEnglish · 3 months agomessage-square50fedilink
minus-squarejbrains@sh.itjust.workslinkfedilinkarrow-up6·3 months agoWhat if role is FILE_NOT_FOUND?!
minus-squarefoxglove (she/her)@lazysoci.allinkfedilinkEnglisharrow-up6·3 months agoif it’s 'FILE_NOT_FOUND' then the string will be read as truthy and you will get 'User is admin' logged.
minus-squareBjörn Tantau@swg-empire.delinkfedilinkarrow-up11·3 months agoAckshually three equal signs check for type as well. So mere truthiness is not enough. It has to be exactly true. Also, everyone knows FILE_NOT_FOUND isn’t a string but a boolean value.
minus-squarefoxglove (she/her)@lazysoci.allinkfedilinkEnglisharrow-up0·3 months agoyeah, it’s funny how my brain collapsed the boolean check into if (role) rather than if (role === true) - that’s tricky what is FILE_NOT_FOUND? I can’t find much on it …
minus-squareBjörn Tantau@swg-empire.delinkfedilinkarrow-up1·3 months agoFILE_NOT_FOUND is from an old story on thedailywtf.com. Someone created a boolean enum with TRUE, FALSE and FILE_NOT_FOUND, if I recall correctly. It’s been a recurring running joke.
minus-squarefoxglove (she/her)@lazysoci.allinkfedilinkEnglisharrow-up2·2 months agothank you for letting me in on the joke 😄 and for catching my error!
What if
roleisFILE_NOT_FOUND?!if it’s
'FILE_NOT_FOUND'then the string will be read as truthy and you will get'User is admin'logged.Ackshually three equal signs check for type as well. So mere truthiness is not enough. It has to be exactly true.
Also, everyone knows FILE_NOT_FOUND isn’t a string but a boolean value.
yeah, it’s funny how my brain collapsed the boolean check into
if (role)rather thanif (role === true)- that’s trickywhat is
FILE_NOT_FOUND? I can’t find much on it …FILE_NOT_FOUND is from an old story on thedailywtf.com. Someone created a boolean enum with TRUE, FALSE and FILE_NOT_FOUND, if I recall correctly. It’s been a recurring running joke.
thank you for letting me in on the joke 😄
and for catching my error!