Questions tagged «associativity»


6
C#条件AND(&&)或(||)优先
我们一直在工作中遇到不必要的编码参数。今天,我问条件AND(&&)或OR(||)是否具有更高的优先级。我的一位同事坚持认为他们的优先级相同,我对此表示怀疑,因此我进行了查找。 根据MSDN,AND(&&)的优先级高于OR(||)。但是,您可以向一个持怀疑态度的同事证明吗? http://msdn.microsoft.com/zh-CN/library/aa691323(VS.71).aspx bool result = false || true && false; // --> false // is the same result as bool result = (false || true) && false; // --> false // even though I know that the first statement is evaluated as bool result = false || (true && …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.