redhead03
35
Q:

c# and

// The or statement in C# is ||
if (a == b || a == c)
{
  // Do something
}
14
// The Or Symbol Is   ||
0
if (true || false) { //Checks if either side is true
  Console.WriteLine("One is true");
}

if (false || false) {
  Console.WriteLine("Both are false");
}

//Output:
//One is true
1
//The AND (&&) statement will return true if both sides are true, 
//otherwise it returns false

if (true && true) { //checks if both sides are true
  Console.WriteLine("Both are true");
}

if (false && true) {
  Console.WriteLine("One or more is false");
}

//Output:
//Both are true
1
bool passed = false;
Console.WriteLine(!passed);  // output: True
Console.WriteLine(!true);    // output: False
1

New to Communities?

Join the community