Re:I got asked LeetCode questions for a dev-ops systems engi...
by hlindwin on Tuesday June 18, 2019 @09:54AM
(#20212977)
I am kind of new to all coding. Can you explain what is wrong with that code?
[ Parent
| on HN ]
Re:I got asked LeetCode questions for a dev-ops systems engi...
by dragonwriter on Tuesday June 18, 2019 @10:02AM
(#20213054)
The catch block merely does exactly what the loop would do at the end end anyway; it's no different than:
catch:
pass
(That is, if the pseudocode isn't making a Rubyish distinction between exception handling and control flow [rescue vs. catch] it's just an extremely verbose way of silently swallowing exceptions, and if it is making a Rubyish distinction it's an extremely verbose way of doing nothing and the whole try/catch construct is unnecessary.)