relational operator An operator that compares two values. allow for assignmentSetting the value of a variable in a computer program. and for comparisons to be made. They are used in conditionIn computing, this is a statement that is either true or false. A computation depends on whether a condition equates to true or false. testing such as IF statementA statement that lets a program select an action depending on whether it is true or not. and loopThe repetition of an activity within a computer program..
Relational operation
Operator
Example
Assignment
=
x = 5
Equivalence
= or ==
if x = 5 or if x == 5
Less than
<
if x < 5
Less than or equal to
<=
if x <= 5
Greater than
>
if x > 5
Greater than or equal to
>=
if x >= 5
Does not equal
<> or !=
If x <> 5 or if x != 5
Relational operation
Assignment
Operator
=
Example
x = 5
Relational operation
Equivalence
Operator
= or ==
Example
if x = 5 or if x == 5
Relational operation
Less than
Operator
<
Example
if x < 5
Relational operation
Less than or equal to
Operator
<=
Example
if x <= 5
Relational operation
Greater than
Operator
>
Example
if x > 5
Relational operation
Greater than or equal to
Operator
>=
Example
if x >= 5
Relational operation
Does not equal
Operator
<> or !=
Example
If x <> 5 or if x != 5
The code below uses a condition to check if the password entered is the correct length of six or more characters:
password 鈫 USERINPUT
IF LEN(password) >= 6 THEN
OUTPUT 鈥淕ood Password!鈥
ELSE
OUTPUT 鈥淧assword too short鈥
ENDIF