cm0002@lemmy.zip to Programmer Humor@programming.dev · 1 个月前More code = more betterlemmy.zipimagemessage-square90linkfedilinkarrow-up1626arrow-down114
arrow-up1612arrow-down1imageMore code = more betterlemmy.zipcm0002@lemmy.zip to Programmer Humor@programming.dev · 1 个月前message-square90linkfedilink
minus-squareOshaqHennessey@midwest.sociallinkfedilinkarrow-up57·1 个月前function myFunction() { try { x = new Random().nextInt(); if (x != 10) { throw "not 10"; } else { return (10) } catch(err) { myFunction() } } } x = myFunction() Commit notes: Added error handling
minus-squarefirewallfail@lemmy.worldlinkfedilinkarrow-up58·1 个月前Returning 10 instead of x when x finally ends up being 10 really ties it together.
minus-squareOshaqHennessey@midwest.sociallinkfedilinkarrow-up27·1 个月前I’m glad you noticed. That was my favorite part too.
function myFunction() { try { x = new Random().nextInt(); if (x != 10) { throw "not 10"; } else { return (10) } catch(err) { myFunction() } } } x = myFunction()Commit notes: Added error handling
Returning 10 instead of x when x finally ends up being 10 really ties it together.
I’m glad you noticed. That was my favorite part too.
Coding on mobile is hard