When using IIF with equality comparison, the variable being compared has it's value changed to that being compares, For example :
LOCAL a%=7
LOCAL b%=0
DEBUG a%+" "+b%+"\n"
b%=IIF(a%=8,1,2)
DEBUG a%+" "+b%+"\n"
In this example, a% gets set to a value of 8 (and b% is set to 1). a% should be kept at 7, as we're testing for equality and not assigning.
And <> can't be used with this command for some reason.
Quote from: MrTAToad on 2014-Jun-11(and b% is set to 1)
This is correct for your example.
But your example gets translated to
b=IIF(a=8,1,2);
so the GPC fails to translate = to ==. That bug is just an other prove that it was a bad idea to use same operator for assignment and comparison.
Indeed - the compiler needs to know = should be used for comparison in IIF and not for value assignment.
Oopsie Daisys
Gesendet von meinem GT-N7100 mit Tapatalk
Fixed it. It was a bug with the equal sign right of an assignment!
LOCAL a% = IIF(1=1, 1, 2)
LOCAL b% = RND(3=4)
LOCAL c% = 4=5=6
works now (next update)
It is not fixed in 12.243 the logfile is wrong on this.
The code from 1st post still fails, since "b=IIF(a=35,3,4)" translated to "b=IIF(a=35,3,4);" instead of "b=IIF(a==35,3,4);". Therefore "b=IIF(35=a,3,4);" is not even compiling. :giveup:
Indeed!
blimey!
:D :D
ok, fixed in next update.