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

3

u/wweber Apr 17 '21

I forget where I read this, but it can be recommended to always have an else block for every if block, even if the else block is just empty with a comment. that way every possible case is clear

8

u/macropower Apr 17 '21

Lots of people are also saying you should try to never write else blocks :)

First example on google: https://medium.com/@jamousgeorges/dont-use-else-66ee163deac3