Proposal: elseif be an alias for elsif (as in foreach and for)

10 Comments

Why?

"elsif" works fine in Perl, Ruby, PL/SQL

Python/C preprocessor use "elif"

PHP uses "elseif"

point taken. This bit me in my "First Days of Perl". Long, long time ago.. ;-)

I was lucky(?) enough to start programming with Ruby, so the switch to "elsif" with Perl wasn't really an issue. "elseif" is very PHP-esque.. so I'm going to say no thank you to this one. However, I wouldn't mind "else if"

Interestingly, in Perl 5.16.1+ perldoc perlfunc lists elseif alongside elsif, and refers you to perldoc perlsyn (which contains no mention of it).

PHP is not the only language to contain an elseif keyword. C pre-processors support #elseif; SQL has it; most BASIC variants do (including VBScript and VB.NET); MATLAB too.

If I didn't know better, this page would lead me to believe that elseif exists in Perl:

http://perldoc.perl.org/functions/elseif.html

Looks like Perl at least knows about it.. I get this

elseif should be elsif at - line 2.

> Reply-to: vsespb: It reduces pain, especially for beginners. No other reason needed :-).

Why not "elif" then? (for those who moved from Python)

> I'm upgrading to 'elseif' bliss (hopefully),

That will make your code harder to read/maintain for Perl and Ruby programmers (like me).

> As soon as 5.18.2 comes out I'm upgrading to 'elseif' bliss (hopefully)

Why do you think "elseif" will be allowed in 5.18.2 ?
it's not allowed in 5.19.3

Leave a comment

About Ron Savage

user-pic I try to write all code in Perl, but find I end up writing in bash, CSS, HTML, JS, and SQL, and doing database design, just to get anything done...