Comparison Operators

noun

say it: “kum-PAIR-ih-sun OP-er-ay-terz” /kəmˈpærɪsən ˈɒpəreɪtərz/

Operators that compare two values and give true or false: == != < > <= >=.

What is Comparison Operators in C#?

Comparison Operators — Operators that compare two values and produce true or false.

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

In a sentence

  • “The comparison operator >= checks whether the score is at least 70.”

Level: Novice · More C# terms at this level

Updated

In other subjects