5
TIL I was over-nesting my if statements for months
I spent 3 weeks on a project checking the same condition in 5 different places. Then my buddy looked at my code and showed me how to combine them into one line. How do you guys spot when you're overcomplicating simple stuff?
2 comments
Log in to join the discussion
Log In2 Comments
nancy_davis16d ago
5 nested ifs seems fine if your code actually needs them.
2
hannah_williams16d ago
Yeah, "if your code actually needs them" is doing a lot of heavy lifting there. I've seen way too many people stack up 5 ifs because they were too lazy to refactor. Keep it clean or keep it short, no middle ground.
-1