why is it always an endless loop? [message #186140] |
Mon, 16 June 2014 16:06  |
Mr Oldies
Messages: 241 Registered: October 2013
Karma: 0
|
Senior Member |
|
|
$a="one"
$b="one"
while ($a=$b){echo "equal"; $b="two";)
This simple code causes an endless loop.
Why?
As soon as $b is changed, they are no longer equal, yet the loop continues.
This does not happen in BASIC.
If it is placement, where then should $b be placed?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: why is it always an endless loop? [message #186165 is a reply to message #186164] |
Tue, 17 June 2014 15:13  |
Denis McMahon
Messages: 634 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On Tue, 17 Jun 2014 08:22:20 +0200, Arno Welzel wrote:
> \|||/
> (o o)
> ,~~~ooO~~(_)~~~~~~~~~,
> | Please |
> | don't feed the |
> | TROLL! |
> '~~~~~~~~~~~~~~ooO~~~'
> |__|__|
> || ||
> ooO Ooo
Arno, I would dearly love to place richard on ignore, as would many other
people, but he has this habit of answering other people's questions,
invariably incorrectly, handing out the worst advice possible from his
years of accumulated ignorance, and presenting the resulting bullshit as
authoritative solutions for them.
Hence it is imperative that those of us who do know what we're talking
about remain vigilant to ensure that the innocent newbies who do attract
his attention receive an appropriate counterpoint.
Unfortunately, as that means we have to read his shit, it also means we
tend to respond to it.
--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
|
|
|