DEV Community

Discussion on: The `else if` Keyword Doesn’t Exist in Java

Collapse
 
_hs_ profile image
HS

My first reaction: of course it doesn't exist there's a space between else and if. But then again second reaction was but hey Ruby does have elsif and what's the actual reason for it. Anyway not impressed by else if part that much (i didn't actually care about those) but something similar in C# I was disappointed is switch case which works a bit different than in Java because I used to propagate steps but it's kind of bad practice so... I'm not sure about what gets me happy or mindblown except for null handling operators like elvis ?: or null coalescing ?? or conditional member acces ?. It's good to have posts like these just to make you think about stuff you don't care/notice otherwise. Thanks

Collapse
 
renegadecoder94 profile image
Jeremy Grifski

I'm not sure that a space necessarily indicates separate keywords. It all depends on how the grammar is written. What's stopping a language grammar from containing else if as a terminal symbol?

Collapse
 
_hs_ profile image
HS

Nothing but my expectations are limited to that space. Even programming languages should think about UX. If you put else if as keyword with a space I wouldn't expect it to be 1 keyword but 2. But that's just my subjective view on that point.