Repository navigation
Revise the AND operator articles - #8687
Conversation
|
Closing and reopening to begin new build. |
|
|
||
| [!code-csharp-interactive[+= examples](~/samples/snippets/csharp/language-reference/operators/AdditionExamples.cs#AddAndAssign)] | ||
|
|
||
| ## Operator overloadability |
There was a problem hiding this comment.
Moving this paragraph and adding this section is a huge improvement, @pkulikov!
|
|
||
| For [bool](../keywords/bool.md) operands, the `&` operator computes the logical AND of its operands. The result of `x & y` is `true` if both `x` and `y` are `true`. Otherwise, the result is `false`. | ||
|
|
||
| The `&` operator evaluates both operands regardless of the value of its first operand, as the following example shows: |
There was a problem hiding this comment.
I'm wondering whether this could use some additional detail or rephrasing. For example, "The & operator evaluates both operands even if the value of the first operand is false, so that the result must be false." My concern here is that inexperienced developers may not realize what this means.
|
|
||
| [!code-csharp-interactive[bool logical AND](~/samples/snippets/csharp/language-reference/operators/AndOperatorExamples.cs#BooleanOperands)] | ||
|
|
||
| The [conditional AND operator](conditional-and-operator.md) `&&` also computes the logical AND of its operands, but evaluates the second operand only if necessary. |
There was a problem hiding this comment.
Here again, the "only if necessary" means that the first operand is true.
|
@rpetrusha thanks a lot for the review. I agree with you: article can be made more explicit. I've made additional changes; please check them. |
|
This looks good, @pkulikov. Thanks for improving this article. I'll merge your PR now. |
This PR revises AND operator reference articles:
+and+=reference pages.)