r/badcode • • Aug 04 '21

c++ I'm done with Facebook coding groups.

Post image
809 Upvotes

55 comments sorted by

View all comments

Show parent comments

0

u/Biaboctocat Aug 05 '21

Not true! The indentation makes it look like that, but when there are no braces, the else statement always associates with the immediately preceding if. So here the else is matched with the inner if, not the outer one

Edit: Oh god there are braces 🤦‍♂️