Menu

#32 equality vs. identity inside loops

open
nobody
None
5
2008-04-23
2008-04-23
No

Hi,

I'm not 100% sure this is a bug, but it is worth looking at:

;-) for c from 1 to 5 do c == 2 endfor;
There are 5 results
<false>
<false>
<false>
<false>
<false>

;-) for c from 1 to 5 do c = 2 endfor;
There are 5 results
<false>
<true>
<false>
<false>
<false>

The expected result is the second result should be <true>, as c is equal to 2. This may simply be expected behaviour, as the integer 2 held in the variable c may not be the same object as the constant 2.

Discussion


Log in to post a comment.