Operator

An operator is a symbol that performs an operation on one or more values. Operators are used to calculate, compare, or manipulate data in a program.

Why operators are important

Operators allow programs to:

  • Perform mathematical calculations
  • Compare values
  • Control logic
  • Modify data

Without operators, programs could not process information.

Main Types of Operators

1. Arithmetic Operators

Used for mathematical calculations.

 

Examples:

+ (addition) - (subtraction) * (multiplication) / (division) % (modulus – remainder)

Example:

10 + 5 → 15

2. Comparison Operators

Used to compare values.

 

Examples:

== (equal to) != (not equal) > (greater than) < (less than) >= (greater or equal) <= (less or equal)

Example:

10 > 5 → true

Comparison operators return a Boolean value (true or false).

 

3.Logical Operators

Used to combine conditions.

 

Examples:

AND (&&) OR (||) NOT (!)

Example:

true AND false → false

4.Assignment Operator

Used to assign a value to a variable.

= (assignment)

Example:

score = 100

Operators and Expressions

Operators are used inside expressions.

 

Example: 

total = price * quantity

Here:

  • *   is the operator
  • price * quantity   is the expression

Why learning operators matters

Operators help you:

  • Build calculations
  • Create logical decisions
  • Control program flow
  • Manipulate variables

They are essential for writing functional programs.

Simple example

Think of operators like tools:

  • + is a calculator button
  • > is a comparison scale
  • = is a label placing a value into a box

Each tool performs a specific action.

Related terms

Source

Information simplified from the Wikipedia article “”.

Nach oben scrollen