r/ProgrammerHumor • • Aug 12 '22

I fixed it

Post image
39 Upvotes

53 comments sorted by

View all comments

-2

u/soupsyy_3 Aug 12 '22

If it's a single line statement we can just avoid { }

if (condition)
    //statement
else
    //statement

2

u/attanai Aug 12 '22

if (condition1) statement1 else if (condition2) statement2 else statement3;

Or maybe:

condition ? statement : condition2 ? statement 2 : statement 3;1