Before learning about relational operators, it is first recommended that you already know what conditional statements are.

If you still don’t know what conditional statements are, you should certainly read this article in which we explain in detail about the subject.

But let’s get down to business!

## What are relational operators?

Relational operators represent the 3rd category of programming operators and, in summary, are used to compare values of variables and create conditional statements.

In this sense, the main programming languages use the following relational operators:

>

which represents **greater than**.

<

which represents **less than**.

>=

which represents **greater than or equal**.

<=

which represents **less than or equal**.

==

which represents **equal**.

!=

which represents **not equal**.

These operators are used in order to create expressions of the **true **or **false **type (fundamental to conditional statements).

It is important to note that some programming languages may still have a few more operators. For example, the *Javascript* language, which also has the following operators:

===

which represents **strictly equal**.

!==

which represents **strictly not equal**.

Just for example, note in the code below the use of the relational operator **<** (less than) in a conditional statement:

1.if(**idade < 18**){

2. println("Você não pode acessar o sistema! É menor de idade!");

3.}

In **line 1** of the code above, we have a conditional expression that checks if the value of the * age *variable is less than 18. In such a way that, if true, the print command in

**line 2**will be executed.

But let’s go a little deeper into the subject!

## Conditional expressions

First, a conditional expression is the product generated by using relational operators. In such a way that, when you use relational operators, you create expressions that return two possible values: **True **or **False**.

The creation of a conditional expression is given by the structure below:

Just to illustrate, here are some examples of conditional expressions:

salary < 3500.00

age >= 18

name != “Jhon”

value == 10

All of these expressions above can be interpreted as **questions **that result in **True** or **False**, and that therefore allow the algorithm to make decisions about whether or not to perform any operations during the execution of a program.

## Do not confuse == with =

One of the common programming operators is the assignment operator, represented by the **=** symbol.

In this sense, it is very common for beginning students to confuse the equality operator **==** with the assignment operator **=**.

However, they have different purposes and work quite differently. So **don’t confuse them**!

## Exercise 1

Now that you certainly understand what conditional expressions are, try the exercise below:

## Exercise 2

Since you have already mastered the concept of relational operators, correctly answer the challenge below:

You have certainly learned the basics of relational operators. But there is still much more to learn.

Relational operators represent the 3rd of the 5 categories of programming operators. So, continue your learning and see our articles about the other operators: