One little known decision structure in VB.NET wasn't covered in the book - IIF. No, I didn't fat-finger the keyboard - that's the way it's spelled and it was part of the VB 6 language as well.
If you have the right requirement in your program, this structure can be a convenient way to code it with fewer keystrokes. It works as shown in the illustration.
Notice that this is a Function ... not a native VB.NET command. That does make a difference. Because it's a function, it returns a value. The expression is evaluated and either TruePart or FalsePart is returned as the value of the function.
You can read about IIF at MSDN- Microsoft's authoritative reference page.
Now it's your turn! Decide to write some great code!


