type Either = { left: T, right: U } local ex = function(value: number): Either if value > 10 then return Either.left("Too big") else return Either.right(value) end end let result: Either = ex(20) if result.left then print("Error: " .. result.left) elseif result.right then print("Result: " .. result.right) end