How do I make it so that something happens if condition a and condition b are true or condition c and condition d are true. I was thinking something like
if a = true && b = true || c = true && d = true
{
Console.Write("Hello")
}
but I am not sure.
Decision making
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Nov 16, 2011, 8:53 AM EST
if ((a && b) || (c && d))
{
Console.Write("Hello");
}
Don't be afraid to use parentheses if (like me) you can't remember the operator precedence rules.
Also no need to do stuff like 'a == true' if 'a' is a boolean expression. Just do 'a'.
Jeremy Stone6 reputationPosted Nov 16, 2011, 8:59 AM EST
VulpesRank #55 · 29.2K reputationPosted Nov 16, 2011, 9:06 AM EST
If say a, b, c and d were ints and you wanted either a and b to be 1 or c and d to be 1, then you'd do this: