Relational Operators in C# – C# Programming Example
C# Console

Relational Operators in C#

Relational operators are used to check the relationship between two operands. If the relationship is true the result will be true, otherwise it will result in false.

Relational operators are used in decision making and loops.

C# Relational Operators
Operator Operator Name Example
== Equal to 6 == 4 evaluates to false
> Greater than 3 > -1 evaluates to true
< Less than 5 < 3 evaluates to false
>= Greater than or equal to 4 >= 4 evaluates to true
<= Less than or equal to 5 <= 3 evaluates to false
!= Not equal to 10 != 2 evaluates to true

Example: Relational Operators

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: