Page 1 of 1 1
Topic Options
#123942 - 2004-07-26 08:23 PM IIF() is executing both conditions
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
IIF() seems to be executing both returnvalues befor returning one of them and this can cause array out of bounds errors.

Code:

$l = -1
$a = 1,2,3,4,5
? iif($l>-1,$a[$l],$l)



if $l is equal to -1 then the IFF() statment should return the false return value... but it is throwing an array out of bounds error because it is evaluating the array value, but you cant have an array value of -1.

you can see the proper behavio by

Code:

? iif($l>-1,"true","false")



that code causes no errors, and returns "false" One would think that the first IIF line of code, would just return the "false" returnvalue with out executing the "true" returnvalue"

Am i mistaken in the behavior of IIF()?

Bryce


Top
#123943 - 2004-07-26 08:29 PM Re: IIF() is executing both conditions
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
oops...

should have searched first :P

link

Top
#123944 - 2004-07-26 10:07 PM Re: IIF() is executing both conditions
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yep, the working and meaning and all that kinda crap of IIF was discussed some time earlier.
I came to conclusion that only reason why IIF was added was the fact that SL folks wanted it in so bad.
it's totally useless and takes a lot of resources and doesn't work as one would think.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 533 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.139 seconds in which 0.117 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org