technically you don't, in this case, because of the return. but if you don't have a return you still need the else, and i'd argue it's clearer/more informative either way.
yeah, depending on what you're trying to do—if everything's decoupled and bar doesn't depend on the success of foo, then this approach is the way to go
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
technically you don't, in this case, because of the
return
. but if you don't have areturn
you still need theelse
, and i'd argue it's clearer/more informative either way.So I will end up having nested try? As in
?
potentially! but like i said, it might be worth refactoring those cases into separate functions
So
Am I getting there?
yeah, depending on what you're trying to do—if everything's decoupled and
bar
doesn't depend on the success offoo
, then this approach is the way to go