Req #26411 [Com]: while {} else {}

From: Date: Wed, 22 Aug 2012 10:44:30 +0000
Subject: Req #26411 [Com]: while {} else {}
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-172793@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=26411&edit=1

 ID:                 26411
 Comment by:         nikic@php.net
 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:

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


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

laruence@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] nikic@php.net

Revert status change.

------------------------------------------------------------------------
[2012-08-22 05:56:57] laruence@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 {

}

------------------------------------------------------------------------
[2012-04-26 02:13:36] ma-martin at hotmail dot de

Hey, i was also looking for some while {} else {} feature...
but i think it could be difficult to implement such a function in php.
Because the else{} event would start after the while{}-loop ends -> everytime after the last
result!
think about it!

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


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


Thread (28 messages)

« previous php.bugs (#172793) next »