Edit report at https://bugs.php.net/bug.php?id=26411&edit=1

 ID:                 26411
 Comment by:         bensor987 at neuf dot fr
 Reported by:        php at bellytime dot com
 Summary:            while {} else {}
 Status:             Open
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   *
 PHP Version:        *
 Block user comment: N
 Private report:     N

 New Comment:

"no such syntax in other languages"....what do you mean ? PHP doesn't have the 
right innovate ? 

I see plenty of cases I would use this syntax. The "else"s would be triggered 
if there hasn't been any iteration in the loop. It means : less variables to 
use (so less memory usage), less code lines, etc... 

There are only advantages to this syntax (and it's pretty simple to understand, 
no KISS violation here). It's not because it isn't done by other languages that 
we shouldn't implement it.


Previous Comments:
------------------------------------------------------------------------
[2012-08-22 10:44:30] ni...@php.net

Python has an "else" for loops, but it means something completely different.

------------------------------------------------------------------------
[2012-08-22 10:29:25] hawkyhawk14 at gmail dot com

larue...@php.net
no such syntax in other languages.
---------------------------------

Python has it and some versions of BASIC have it aswell.

------------------------------------------------------------------------
[2012-08-22 10:09:30] ni...@php.net

Revert status change.

------------------------------------------------------------------------
[2012-08-22 05:56:57] larue...@php.net

no such syntax in other languages.

------------------------------------------------------------------------
[2012-08-21 17:38:24] bensor987 at neuf dot fr

Why don't you go a little bit further ?

while ( $row = mysql_fetch_assoc( $result ) ){

} else for ( $i = 0; $i < $cpt; $i++ ) {

} else if ( $dude ) {

} else {

}

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=26411


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=26411&edit=1

Reply via email to