The iif function implements an immediate "if" clause, returning one of two possible values.
result = iif(condition, trueval, falseval)
Parameters
condition is the logical condition to test. trueval is the value to return if the condition evaluates to true, falseval if the condition evaluates false.
Return Value
trueval is the condition evaluates true, falseval otherwise.
Examples
result = iif(os.is("windows"), "is windows", "is not windows")
Note that all expressions are evaluated before the condition is checked; the following expression can not be implemented with an immediate if because it may try to concatenate a string value.
result = iif(x ~= nil, "x is " .. x, "x is nil")



You can do the same using the logical operators:
local os = ( os.is("windows") and "is widows" ) or "is not window"
using this you can also do the concat example
local result = ( x and "x is " .. x ) or "x is nil"
You can also just
result = a and b or cThere isn't any need for the parentheses in the above comment, but thats more stylistic. iif could be dangerous, too, if you wanted to make sure you didn't divide by zero or something. And and or do short circuiting.