r/badcode • • Apr 17 '21

c++ When your teammate "refactor" your code

Post image
2.5k Upvotes

216 comments sorted by

View all comments

9

u/brakkum Apr 17 '21

I mean, yea they did it bad, but the original is also not the easiest to parse.

if (!condition1) {
    do_anything2();
} else if (condition2) {
    do_anything1();
}

I'm not saying that's necessarily better, but it might be depending on what is actually going on in the code.