Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
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.) -
nested for loop sometimes unavoidable, but nested if is too prone for bugs, especially combined with conditions which needs to be bracketed correctly.
-
arekxv10543yInvert 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 :) -
Nesting means that you have no control flow.
No control flow means the code is shit.
No discussion.
Related Rants
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?
joke/meme
loops
hey if it works
dear god