You are here: Re: coding tip to prevent comparisons becoming assignments « PHP Programming Language « IT news, forums, messages
Re: coding tip to prevent comparisons becoming assignments

Posted by Geoff Berrow on 03/21/06 15:35

Message-ID: <yYY8TIACX8HEFw1+@eminent.demon.co.uk> from Peter Fox
contained the following:

>A way to 'burn-in' mental processes in order to distinguish = and == is
>to 'say' "=" as one word and "==" as two. For example "equals" and "is
>equal" (or "equals" and "equal to") and to get into the habit of
>'saying' conditional statements using the two word form.
>$a =[equals] $b;
>if($a =[equal]=[to] $b){ ...

A better way is not to mention equals at all

= is the assignment operator
== is the comparison operator

$a=[takes the value of]$b;
if($a ==[has the same value as] $b){ ...

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

 

Navigation:

[Reply to this 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

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