What is the quickest way to replace a variable if a condition is met?

后端 未结 0 756
挽巷
挽巷 2021-01-18 19:27

I often use code of this form:

object.attribute=object.attribute=="forbidden value"?
                 object.attribute:"allowed value";


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题