9

Anyone else just nest a bunch of ifs and loops and feel absolutely disgusted but it works so you don't want to refactor it?

Comments
  • 2
    Every goddamn day
  • 1
    I mean, only if we have such multidimensional structures and complexity became a necessity, what's wrong?

    (OK, I may not approve of nested "if"-s, because I don't see what's below.)
  • 0
    nested for loop sometimes unavoidable, but nested if is too prone for bugs, especially combined with conditions which needs to be bracketed correctly.
  • 0
    Invert if check and use return as an exit. You lose one nesting level and save your sanity. I do those without thinking now. Its just a part of writing clean code for me.

    You can do the same inside for if you use continue instead of return. Reads waaay better :)
  • 0
    Nesting means that you have no control flow.

    No control flow means the code is shit.

    No discussion.
Add Comment