-- 三元运算符,解决B值为false的情况
local value = true
local open = false
local result = (open and {value} or {open})[1]
print(tostring(result))
local num = 2
local a = num <= 1 and 0 or num
print(a) -- a = 2
-- 三元运算符,解决B值为false的情况
local value = true
local open = false
local result = (open and {value} or {open})[1]
print(tostring(result))
local num = 2
local a = num <= 1 and 0 or num
print(a) -- a = 2