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
OperatorOperator NameExample
==Equal to6 == 4 evaluates to false
>Greater than3 > -1 evaluates to true
<Less than5 < 3 evaluates to false
>=Greater than or equal to4 >= 4 evaluates to true
<=Less than or equal to5 <= 3 evaluates to false
!=Not equal to10 != 2 evaluates to true

Example: Relational Operators

 

Leave a Comment

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