Re: While-else

From: Date: Thu, 03 May 2007 07:27:56 +0000
Subject: Re: While-else
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-29134@lists.php.net to get a copy of this message
It can save you one if-statement, where the condition would be identical to the where condition. Example: if ($i <= 10) { while ($i <= 10) { $i++; } } else { echo "$i is more than 10\n"; } I personally hate overspecifications, and this is one situation where that's the case. So actually, I would like while-else support. Just my humble 2 futile cents of course. Regards, Ron ""Richard Lynch"" <ceo@l-i-e.com> schreef in bericht news:35014.216.230.84.67.1178133032.squirrel@www.l-i-e.com... > On Sat, April 28, 2007 1:03 pm, Pelle Ravn Rosfeldt wrote: >> Is it possible to make a "while" with a "else"-statement in PHP6? >> I know that it's not the first time this subject is up, but my >> research >> shows that a lot of people miss it. Including me. >> >> Here's an example of what I mean: >> --------------------- >> <? >> $i = 1; >> while ($i <= 10) { >> echo $i++; >> } else { >> echo "The while couldn't be executed!"; >> } >> ?> >> --------------------- > > So it executes after the last iteration? > > No. > > It must only execute if there were no iterations?... > > Maybe I'm just an old fart, but I don't like it... > > :-v > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some indie artist. > http://cdbaby.com/browse/from/lynch > Yeah, I get a buck. So?

« previous php.internals (#29134) next »