C# has these logical operators, which are given in table with description:
&& | Logical AND |
|| | Logical OR |
! | Logical NOT |
& | Bitwise logical AND |
| | Bitwise logical OR |
^ | Biwise logicalĀ NOT |
The logical operators && and || are used when we want to form compound conditions by combining two or more relations. For example:
X < y && y==10
This type of expression combines two or more relational expressions is termed as a logical expression or a compound relational expression. The logical expression given above is true only if both x < y and y ==10 are true. If either (or both) of them are false, the expression is false. Like the simple expression, a logical expression also yields a value of true or false according to given truth table:
Expression 1 | Expression 2 | Expression 1 && Expression 2 | Expression 1 || Expression 2 |
True | True | True | True |
True | False | False | True |
False | True | False | True |
False | False | False | False |
How can I use the AND and OR operator in single expression.
Please provide me an example in vb.net.
Thanks in advance..