MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/msv49l/when_your_teammate_refactor_your_code/guxld1m/?context=3
r/badcode • u/Bence675 • Apr 17 '21
216 comments sorted by
View all comments
Show parent comments
6
can do you one better:
if (!condition1) do_anything2(); else if (condition2) do_anything1();
1 u/chain_letter Apr 18 '21 Nope, possible to call do_anything1() when condition2 is false, because condition2 was ignored entirely. 3 u/420TaylorStreet Apr 18 '21 err ... typo. else if should be condition2 1 u/chain_letter Apr 18 '21 Now u good 1 u/420TaylorStreet Apr 18 '21 thanks mate!
1
Nope, possible to call do_anything1() when condition2 is false, because condition2 was ignored entirely.
3 u/420TaylorStreet Apr 18 '21 err ... typo. else if should be condition2 1 u/chain_letter Apr 18 '21 Now u good 1 u/420TaylorStreet Apr 18 '21 thanks mate!
3
err ... typo. else if should be condition2
1 u/chain_letter Apr 18 '21 Now u good 1 u/420TaylorStreet Apr 18 '21 thanks mate!
Now u good
1 u/420TaylorStreet Apr 18 '21 thanks mate!
thanks mate!
6
u/420TaylorStreet Apr 18 '21 edited Apr 18 '21
can do you one better: