AI助手支持GPT4.0
if function里面 && 和 || 竟然出现一样的答案?In the if function, && and || appear to have the same answer?
if function里面 && 和 || 竟然出现一样的答案?
if (this.data.inputValue1!='' || this.data.inputValue2!='' || this.data.inputValue3!='' || this.data.inputValue4!='') { this.setData({ clsStatus: false }) } else { this.setData({ clsStatus: true }) }以上就是我纠结了一晚上的代码。上面的代码是成功使用的。如果任意一个inputValue不为空,都会变成false。但是问题是我希望设置,如果任意一个inputValue为空,变成false。系统则不让我过。我也不知道什么原因。我就是将上面的 || 换成 &&, 但是结果竟然还是一样的。太奇怪了。 不知道别人有没有遇到一样的问题?谢谢大家的时间!
if ( this.data.inputVal ue1!='' || this.data.inputValue2 !='' || this.data.inputValue3 !='' || this.data.inputValue4 !='') { this.setData ({ clsStatus: false }) } else { this.setData (clsstatus: true)} that's what I've been struggling with all night Code. The above code was used successfully. If any inputvalue is not empty, it will become false. But the problem is that I want to set it to false if any inputvalue is empty. The system won't let me. I don't know why. I just changed the |, but the result was the same. It's strange. I don't know if other people have the same problem? Thank you for your time!
xieyao.
是要实现“如果任意一个inputValue为空,变成false”这个需求?
if (this.data.inputValue1=='' || this.data.inputValue2=='' || this.data.inputValue3=='' || this.data.inputValue4=='') { this.setData({ clsStatus: false }) } else { this.setData({ clsStatus: true }) }