?: multiple ifs c# code example
Example 1: multiple if statements c#
//the same rules that are in math, applies also in programming -
//the computer checks the statements surrounded with parentheses first
//just like you do calculations with parentheses first :)
if((a == 0 || b == 0) && (x == 0 || y == 0))
{
//if one of a or b equals 0 AND one of x or y equals 0 then this runs
}
Example 2: c# if statement with 2 conditions
if (checkbox.checked)
{
if (columnname != a && columnname != b && columnname != c)
{
"statement 1"
}
}
else
{
if (columnname != a && columnname != b && columnname != c
&& columnname != A2)
{
"statement 1"
}
}