irelephant 🍭@lemm.ee to Programmer Humor@programming.devEnglish · 17 days agolooks good to melemm.eeimagemessage-square43fedilinkarrow-up1735
arrow-up1735imagelooks good to melemm.eeirelephant 🍭@lemm.ee to Programmer Humor@programming.devEnglish · 17 days agomessage-square43fedilink
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up74·17 days agotry { operation(); } catch { // nice weather, eh? }
minus-squareKaryoplasma@discuss.tchncs.delinkfedilinkarrow-up14·edit-217 days agoStarting with Java 21 (I think), they’ve introduced ignored variables, so you can now actually do this: try { operation(); } catch (Exception _) { // nice weather, eh? } Edit: forgot that this is about JS lel
minus-squarejubilationtcornpone@sh.itjust.workslinkfedilinkEnglisharrow-up7·17 days agoSo basically the same as a discard in C#?
minus-squareKaryoplasma@discuss.tchncs.delinkfedilinkarrow-up1·edit-217 days agoYeah, Python has it as well. I think the only real use of it is code readability since you declare that this variable will never be used.
minus-squarelengau@midwest.sociallinkfedilinkarrow-up3·17 days agowith contextlib.suppress(BaseException): do_thing()
try { operation(); } catch { // nice weather, eh? }
Starting with Java 21 (I think), they’ve introduced ignored variables, so you can now actually do this:
try { operation(); } catch (Exception _) { // nice weather, eh? }
Edit: forgot that this is about JS lel
So basically the same as a discard in C#?
Yeah, Python has it as well. I think the only real use of it is code readability since you declare that this variable will never be used.
☑️ PR Approved
Thanks. I hate it.