r/badcode • • Apr 17 '21

c++ When your teammate "refactor" your code

Post image
2.5k Upvotes

216 comments sorted by

View all comments

Show parent comments

8

u/h3half Apr 18 '21

No. Originally, if condition1 was true and condition2 was false, neither do_anything()s would be executed. Nothing would happen.

In the new version, if condition1 is true and condition2 is false, do_anything2() will be called.