Posted by Peter Fox on 03/22/06 11:30
Following on from Oli Filth's message. . .
>Peter Fox said the following on 21/03/2006 09:22:
>>
>> Here is a precis of my standard lecture (shortly to be a book) on equals.
>>
>>
>> The use of = and == is *full* of traps
>>
>> $totalCake = 100;
>> $slices = 7;
>> $slice = $totalCake / $slices;
>> $cakeLeft = $totalCake;
>> while ($cakeLeft != 0){ // will this loop terminate? Always?
>> $cakeLeft = $cakeLeft - $slice;
>> }
>> // Crumbs!!
>
>
>How does that demonstrate the pitfalls of = and == ?
>
>
The same way as "In tonight's programme we'll talk to Hugh Jampton,
captain of Britain's five-a-side archery team *and* later visit the new
indoor hang gliding centre at Little Bagworth. But first here are the
results of today's Woolworth's League (division 2) downhill crochet
matches."
Hope that explains the use of "and".
--
PETER FOX Not the same since the adhesive company came unstuck
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
[Back to original message]
|