Skip to content

Instantly share code, notes, and snippets.

@cxmeel
Created August 30, 2018 23:00
Show Gist options
  • Save cxmeel/1836a352c64cfc51d703dad227a7d620 to your computer and use it in GitHub Desktop.
Save cxmeel/1836a352c64cfc51d703dad227a7d620 to your computer and use it in GitHub Desktop.
Returns a given value based on whether the condition evaluates to true or false.
--[[
clockworksquirrel.iif
Returns a given value based on whether the condition evaluates to true or false.
Usage:
<variant> IIF(<boolean> expression, <variant> value_if_true, <variant> value_if_false)
--]]
return function(Condition, IfTrue, IfFalse)
if (not not Condition) then return IfTrue end
return IfFalse
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment