Coding Cookbook/Inline If
Appearance
Not every language offers an Inline If function.
VBScript solution
[edit | edit source]function IIf (boolValue, varTrue, varFalse) ' Inline If
if boolValue then IIf = varTrue else IIf = varFalse
end function
strFoo = IIf( 1>2, "x", "y" ) ' result: strFoo = "y"