In C#, how do I specify OR:
if(this OR that) {do the other thing}
I couldn\'t find it in the help.
Update:
The OR operator is a double pipe:
||
So it looks like:
if (this || that)
{
//do the other thing
}
EDIT: The reason that your updated attempt isn't working is because the logical operators must separate valid C# expressions. Expressions have operands and operators and operators have an order of precedence.
In your case, the == operator is evaluated first. This means your expression is being evaluated as (title == "User greeting") || "User name"
. The || gets evaluated next. Since || requires each operand to be a boolean expression, it fails, because your operands are strings.
Using two separate boolean expressions will ensure that your ||
operator will work properly.
title == "User greeting" || title == "User name"