T
14

PSA: I was coding for 6 months before a senior dev at a meetup pointed out I was nesting if statements 5 levels deep

He showed me how to flip the logic with early returns and suddenly my 200-line function turned into 50 lines, has anyone else had a senior dev completely rewire how you think about code structure at a meetup?
2 comments

Log in to join the discussion

Log In
2 Comments
the_xena
the_xena2d ago
My mate had a senior dev rewrite his whole approach in one 10 minute chat.
2
the_miles
the_miles1d ago
That "flip the logic" trick single-handedly cleaned up my code overnight.
1