Comp.operators.md - brainchildservices/curriculum GitHub Wiki

Slide 1

Comparison Operators

Comparison operators are used in logical statements to determine equality or difference between variables or values.

Given that x = 5, the table below explains the comparison operators:

image

How Can it be Used

Comparison operators can be used in conditional statements to compare values and take action depending on the result:

 if (age < 18) text = "Too young to buy alcohol";

You will learn more about the use of conditional statements in the next chapter of this tutorial.