20 ms·
IMO the example you provided is an anti-pattern. There are better ways to avoid deeply nested code, but it depends on the programming language. I try to make e
by nivertech 3y ago
IMO the example you provided is an anti-pattern.
There are better ways to avoid deeply nested code, but it depends on the programming language.
I try to make each method/function to have a single entry and a single exit.
Cond, case, pattern maching in function heads, decision tables, and syntactic sugar in some PLs, allow you to flatten the nested code / branchinbg / conditionals.
- hamdouni 3y agoMaybe. Or maybe it is not obvious with a small example. Not sure about the anti-pattern, but I'm sure an anti-conventional coder ;-)