fxm, could you explain the second part?fxm wrote:IIf returns a different numeric or string or UDT value (not a reference) depending of the result of a conditional expression. Its typical use is in the middle of an expression; it avoids splitting it to put a conditional in the middle.
In the particular case where the condition is resolved at compile-time, IIf returns the original expression itself that satisfies the condition (otherwise, it only returns an evaluation of the expression at run-time).
Are you saying the behaviour is different when the condition is evaluated at compile-time?
Or are you just saying that fbc doesn't bother emitting the expression that won't be used?
e.g.
Code: Select all
print iif(true, expr1, expr2)
Code: Select all
print expr1
Is there any difference to the program behaviour when the condition is constant, or does it just result in faster/shorter emitted code?