Operators

We use operators to adjust, compare, or evaluate information.

Specifically, we can use operators to make calculations (using arithmetic operators), compare two values (using comparison operators), or compare multiple values and expressions (using logic or boolean operators).

1. Arithmetic operators

We use arithmetic operators to make calculations based on the outcomes we need. The operators are: +, -, *, and /.

2. Comparison operators

We use comparison operators to compare and evaluate the relationship between two values. This comparison results in a boolean. The comparison operators are: < (less than), > (more than), and == (equal to).

For the ==, we’re not assigning a variable, rather we’re checking a value (or comparing if a value equals another).

3. Logical (or boolean) operators

We use logical operators to compare multiple boolean values and expressions.

Think of logical operators as ‘advanced comparison operators.’ Because rather than comparing just two values (as is the case with comparison operators), we’re comparing multiple values.

The logical operators are: AND, OR, and NOT.

Keep in mind: Operators may look different, depending on the programming language that you’re working with. This is because different programming languages have different syntax (or the set of rules that defines how each programming language is written).

1 thought on “Operators”

Leave a Comment