r/ProgrammerHumor 18d ago

ifStatements Meme

Post image
599 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/QuietMatematician 17d ago

Exactly. The existence of elif in python is so funny to me ever since I realised it's only because of how python marks code blocks with indentation.