shawn, not sure is this what you mean but this got into my mind.

as iif first executes it's parameters (like any function) it does not behave in expected matter.

it seems that it tries to count the second parameter and as it kind of calls itself, it will keep calling until the stack-space roof has been reached...

yes, made a test script to prove this.

code:
$var=1
$loopcount
test()

function test()
$loopcount=$loopcount+1
$loopcount ?
$var=iif($var=1,$var,test())
endfunction

_________________________
!

download KiXnet