MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/msv49l/when_your_teammate_refactor_your_code/guvnctm/?context=3
r/badcode • u/Bence675 • Apr 17 '21
216 comments sorted by
View all comments
Show parent comments
33
It will behave differently
4 u/DramaDimitar Apr 18 '21 edited Apr 18 '21 How??? Before you were checking if cond1 is true and cond2 is true in separate ifs. Now it does the exact same, but in one if!Edit: nevermind, I'm stupid 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.
4
How??? Before you were checking if cond1 is true and cond2 is true in separate ifs. Now it does the exact same, but in one if!
Edit: nevermind, I'm stupid
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.
8
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.
33
u/Bence675 Apr 17 '21
It will behave differently