Reply to Re: if an multiple statements

Your name:

Reply:


Posted by Michael Fesser on 01/07/08 17:23

..oO(Steve)

>"Michael Fesser" <netizen@gmx.de> wrote in message
>news:pmk4o3trg1johm5rcaiho04qaos5kbd5rg@4ax.com...
>
>> PHP uses lazy evaluation. As soon as the result is known, the evaluation
>> stops. Because of this behaviour you can write things like
>
>more pragmatic than lazy. if one condition is false, there is no possible
>way other &&'ed conditions could change that result...so, why continue the
>evaluation?

Correct, and one common name for that technique is "lazy evaluation" (or
"delayed evaluation"): the result of an expression is only calculated if
and when it's really necessary.

>most languages do it this way. of those that i've used, vb was the only one
>that continued to blindly evaluate conditions. it wasn't until vb.net that
>the AndAlso and OrElse short-circuit constructs were added - 'short-circuit'
>being even more descriptive than 'lazy' or 'pragmatic'.

AFAIK "short-circuit" is more related to logical expressions, whereas
"lazy evaluation" is the more general name and applies to many other
things as well.

Micha

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация