Binette@lemmy.ml to Learn Programming@programming.devEnglish · 2 months agoIs it better to check if a file exists before trying to load it, or to try to load it, and catch the error and move on?message-squaremessage-square16fedilinkarrow-up137arrow-down10file-text
arrow-up137arrow-down1message-squareIs it better to check if a file exists before trying to load it, or to try to load it, and catch the error and move on?Binette@lemmy.ml to Learn Programming@programming.devEnglish · 2 months agomessage-square16fedilinkfile-text
minus-squarecarl_dungeon@lemmy.worldlinkfedilinkEnglisharrow-up3arrow-down2·2 months agoI would explicitly check in this case - but this might not be the right way if you were doing something else, like updating a row in a table millions of times a second. It’s always context dependent.
I would explicitly check in this case - but this might not be the right way if you were doing something else, like updating a row in a table millions of times a second. It’s always context dependent.