DEV Community

loading...

Discussion on: When is nesting good or neutral?

Collapse
dannypsnl profile image
林子篆

A few cases, sometimes we cannot extract out a function because the abstraction is bad for maintaining, however, we have a complex condition like: if a && b && c, in case I prefer if a { if b { if c {} else {} } else {} } else {}. But most of the time I can find out how to extract it as a new function, but if really cannot do that, simple-ugly is better than elegant-hiding-the-problem.

Forem Open with the Forem app