@Aijan@programming.dev to Programming@programming.dev • 5 months agoSelf-documenting Codelackofimagination.orgexternal-linkmessage-square71fedilinkarrow-up1102arrow-down116
arrow-up186arrow-down1external-linkSelf-documenting Codelackofimagination.org@Aijan@programming.dev to Programming@programming.dev • 5 months agomessage-square71fedilink
minus-square@traches@sh.itjust.workslinkfedilinkEnglish47•5 months agoAgreed. OP was doing well until they replaced the if statements with ‚function call || throw error’. That’s still an if statement, but obfuscated.
minus-square@BrianTheeBiscuiteer@lemmy.worldlinkfedilink7•5 months agoDon’t mind the || but I do agree if you’re validating an input you’d best find all issues at once instead of “first rule wins”.
minus-square@rooster_butt@lemm.eelinkfedilink3•5 months agoShort circuiting conditions is important. Mainly for things such as: if(Object != Null && Object.HasThing) … Without short circuit evaluation you end up with a null pointer exception.
Agreed. OP was doing well until they replaced the if statements with ‚function call || throw error’. That’s still an if statement, but obfuscated.
Don’t mind the
||
but I do agree if you’re validating an input you’d best find all issues at once instead of “first rule wins”.Short circuiting conditions is important. Mainly for things such as:
Without short circuit evaluation you end up with a null pointer exception.