Rust-logical-operators
提供:Dev Guides
Rust-論理演算子
論理演算子は、2つ以上の条件を結合するために使用されます。 論理演算子もブール値を返します。 変数Aの値が10で、Bが20であると仮定します。
Sr.No | Operator | Description | Example |
---|---|---|---|
1 | && (And) | The operator returns true only if all the expressions specified return true | (A > 10 && B > 10) is False |
2 | (OR) | ||
The operator returns true if at least one of the expressions specified return true | (A > 10 | B >10) is True | |
3 | ! (NOT) | The operator returns the inverse of the expression’s result. For E.g.: !(>5) returns false | !(A >10 ) is True |