3 ms·
I was curious about the elseif complaint so I looked into how different languages do it. This is nowhere near a comprehensive list but elif seems to be the leas
by guelo 13y ago
I was curious about the elseif complaint so I looked into how different languages do it. This is nowhere near a comprehensive list but elif seems to be the least popular.
elif: sh, python
elseif: PHP, Modula-2, Dylan, Eiffel, Oz, Matlab, Julia
elsif: Perl, Ruby, Ada, Modula-3, Tcl,
else if: Awk, B, C, C#, C++, Java, JavaScript, Pike, YCP, OCaml, Delphi, Pascal
- cgag 13y agoIt's surprising it's less popular than elsif. I'd think you'd either go full on with shortening it (kind of surprised there's no "ef" now that I think about it), or just spell it right.
- caioariede 13y agoNimrod (http://nimrod-code.org/ http://nimrod-code.org/) also uses elif
- andrewcooke 13y agohuh. thanks. i had no idea elseif was so common. so after seeing that i am pretty sure they have taken it from matlab.
- evincarofautumn 13y ago“elif” also appears in the C preprocessor.
- tomp 13y agoGo uses `else if` as well, but since it requires braces `{ }` for statements in the "then" or else clauses, it doesn't have the dangling else problem.
- dchest 13y ago+ elseif: Lua