Irelephant@lemm.ee to Programmer Humor@programming.devEnglish · 5 days agolooks good to melemm.eeimagemessage-square43fedilinkarrow-up1716arrow-down18
arrow-up1708arrow-down1imagelooks good to melemm.eeIrelephant@lemm.ee to Programmer Humor@programming.devEnglish · 5 days agomessage-square43fedilink
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up72arrow-down1·5 days agotry { operation(); } catch { // nice weather, eh? }
minus-squareKaryoplasma@discuss.tchncs.delinkfedilinkarrow-up14·edit-25 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·5 days agoSo basically the same as a discard in C#?
minus-squareKaryoplasma@discuss.tchncs.delinkfedilinkarrow-up1·edit-24 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·4 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.