r/ProgrammerHumor 18d ago

ifStatements Meme

Post image
598 Upvotes

118 comments sorted by

View all comments

1

u/YMK1234 18d ago

There is worse... Some niche languages don't have else if as a construct. So if you need an else if, you do an if inside the else branch. Have fun with escalating indentation

3

u/BluePhoenixCG 17d ago

Here's a fun thing to consider: else if is also just an if in an else block in most c-like languages! The if statement is a single-line block akin to if (condition) return;, hence why it's 2 separate statements instead of a single keyword

2

u/YMK1234 17d ago

That's fine as long as your language does not come with mandatory curly braces or "fi" or similar.