Logical Operators

noun

say it: “LOJ-ih-kul OP-er-ay-terz” /ˈlɒdʒɪkəl ˈɒpəreɪtərz/

Operators that combine or flip true-or-false conditions: && (and), || (or) and ! (not).

What is Logical Operators in C#?

Logical Operators — Operators that combine or reverse boolean conditions.

class Venue
{
    bool CanEnter(int age)
    {
        bool isAdult = age >= 18;
        bool isSenior = age >= 65;
        return isAdult && !isSenior;
    }
}

In a sentence

  • “With the logical operator &&, the discount needs both a coupon and a total over $50.”

Level: Novice · More C# terms at this level

Updated

In other subjects