Tag: 三元

没有其他的Python三元运算符

是否有可能在Python的1行上做到这一点? if <condition>: myList.append('myString') 我尝试了三元运算符 myList.append('myString' if <condition>) 但我的IDE(MyEclipse)不喜欢没有别的。

Lua中的内联条件(a == b?“yes”:“no”)?

有没有在Lua中使用内联条件? 如: print("blah: " .. (a == true ? "blah" : "nahblah"))