Python&Swift 三元(目)运算
Python的三元运算写法:
is_true = True
result = 'TRUE' if is_true else 'FALSE'
# output: TRUE
Swift的三元运算写法:
isTrue = true
result = isTrue ? "TRUE" : "FALSE"
// output: TRUE
Python的三元运算写法:
is_true = True
result = 'TRUE' if is_true else 'FALSE'
# output: TRUE
Swift的三元运算写法:
isTrue = true
result = isTrue ? "TRUE" : "FALSE"
// output: TRUE