I'm beginning to think that the IIF statement evaluates both TRUE and FALSE statements before determining the state of the IF!
If I add the following code:
Code:
$zz = iif(VarType($sValue) & 8192, 'Array', 'Var')
'zz=' $zz ' : ' @SERROR ?
It completes successfully and prints the appropriate type.
Code:
$zz = iif(VarType($sValue) & 8192, UBound($sValue), 'Var')
'zz=' $zz ' : ' @SERROR ?
It completes successfully and displays the expected values.
However, if I change it to:
Code:
$zz = iif(VarType($sValue) & 8192, Join($sValue, '|', UBound($sValue)), 'Var')
'zz=' $zz ' : ' @SERROR ?
It returns the error 87. As Lonk pointed out, UBound returns a "-1" when it is a simple string, which would be invalid IF the statement is executed - which you would believe it isn't.
So, it appears that the current implementation of IIF can't be used to return values from statements if they might be invalid under any condition!
I wonder if this should be addressed with Ruud?
Glenn