What are the logical operators available in C #
Today, I would like to share with you the relevant knowledge points of the logic operators available in C#. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article, let's take a look at it.
Example
Take a look at the following example to see all the logical operators available in C#:
Using System
Namespace OperatorsAppl
{
Class Program
{
Static void Main (string [] args)
{
Bool a = true
Bool b = true
If (a & b)
{
Console.WriteLine ("Line 1-condition is true")
}
If (a | | b)
{
Console.WriteLine ("Line 2-condition is true")
}
/ * change the values of an and b * /
A = false
B = true
If (a & b)
{
Console.WriteLine ("Line 3-condition is true")
}
Else
{
Console.WriteLine ("Line 3-condition is not true")
}
If (! (a & b))
{
Console.WriteLine ("Line 4-condition is true")
}
Console.ReadLine ()
}
}
}
When the above code is compiled and executed, it produces the following results:
Line 1-condition is true Line 2-condition is true Line 3-condition is not true Line 4-condition above is "what are the logical operators available in C#", thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.