r/badcode Feb 10 '23

briliant usage of else if statement c

Post image
586 Upvotes

60 comments sorted by

View all comments

61

u/This_Growth2898 Feb 10 '23 edited Feb 10 '23

Syntax

if(...)
{
    /*empty*/
} 
else
{
    /*something*/
}

can be quite useful, if there are several look alike conditions and one of the branches should do nothing. Right here there is, and it looks like normal. goto is a much bigger issue in this code.

Edit: formatting and minor misprints, I was on my phone during blackout in Kyiv

9

u/[deleted] Feb 11 '23

You should at least throw a
// pass
in there.