Learn
Conditionals & Logic
Relational Operators

When writing conditional statements, sometimes we need to use different types of operators to compare values. These operators are called relational operators.

To have a condition, we need relational operators:

  • == equal to
  • != not equal to
  • > greater than
  • < less than
  • >= greater than or equal to
  • <= less than or equal to

Relational operators compare the value on the left with the value on the right.

Instructions

1.

Change the condition grade > 60 to grade < 60.

What do you think will happen?

2.

Change the condition grade < 60 to grade != 60.

What do you think will happen?

Folder Icon

Take this course for free

Already have an account?