IIF(expr, truepart, falsepart)

Returns one of two parts, depending on the evaluation of an expression.

exprThe expression you want to evaluate.
truepartThe value or expression returned if "expr" is True.
falsepartThe value or expression returned if "expr" is False.

* This function always evaluates both truepart and falsepart, even though it returns only one of them. Because of this, you should watch for undesirable side effects.
* For example, if evaluating falsepart results in a division by zero error, an error occurs even if expr is True.
* This is also better known as the Immediate If function.
* This function should not be used as it leads to code being harder to read and understand.
* The equivalent .NET function is Microsoft.VisualBasic.Interaction.IIF
* For the Microsoft documentation refer to learn.microsoft.com

IIF(true, "It is true", "it is false") = "it is true" 
IIF(false, "It is true", "it is false") = "it is false"

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited Top