VB.NET Chapter #2 - What IIF?

Don’t let them trick you! MSDNs description of the IIF function is not correct.

The IIf function provides a counterpart for the ternary Conditional Operator: ? : in Visual C++.

There is a slight difference that at some point will manifest itself and rise to the surface, not as pure artesian water, but as scalding geyser (or a bug). The conditional operator will, based on the conditional part, evaluate and return either the true or the false statement. That is, either the the true or the false statement is evaluated, not both. Whereas the IIF operator evaluates both the true and the false statement - always.

The similarity is that in either case only one result is returned.

Leave a comment...

Powered by WordPress. Entries (RSS) and Comments (RSS).