seegongsik
Programming

What are operators in programming

Symbols that do something with values, like plus, minus, greater than, and equal to, are called operators. Some make a new value, and some compare two values and give true or false. The true or false that conditions used in the last lesson comes from right here.

01

Add, subtract, multiply

The most familiar operators are for calculating.
Put in two values with plus, minus, times, or divided by, and one new value comes out.
Change the symbol below and you'll see right away how the result changes.

=11
7 plus 4 is 11. Change the symbol and the result changes.

Two values plus one symbol make a new value. It starts at 7 + 4 = 11.

Two numbers and one symbol are all you need.
Depending on the symbol, the numbers get added or subtracted.
Operators that make a new value from values like this are arithmetic operators, just like on a calculator.

02

Greater, less, equal

Another kind of operator compares two values.
Compare two values with "greater than, less than, equal to," and what comes out isn't a number but true or false.
"7 is greater than 4" is true, and "7 is equal to 4" is false.

7 > 4 → true
A comparison operator gives true or false. It is the very true·false that the "if" used last time.

Compare two values and you get true or false. It starts at 7 > 4 → true.

Calculating operators make new values, and comparing operators give true or false.
The "if" in the last lesson chose its path with exactly this true or false.

03

What does this symbol do?

Let's meet the operator symbols one by one.
What each one does is summed up in a line: adding, subtracting, comparing.
Tap a symbol and its meaning appears.

Plus
Adds two values into a new value · calculation
Yellow symbols calculate (new value), blue symbols compare (true·false).

Tap a symbol to see what it means. Yellow symbols calculate (new value); blue symbols compare (true or false).

There aren't many symbols.
Yet with just these few, you can add and build decisions.
Each is simple, but together they can do almost anything: small tools.

04

True or false leads to the fork

Why do comparing operators matter?
Because the true or false they give is the switch for the "if" fork we saw in the last lesson.
Compare "Is the score 60 or more?": if true, take the pass path; if false, the fail path.

compare
75 ≥ 60
→
true·false
true
→
if (fork)
pass
Score
The true·false a comparison operator gives moves the "if" fork from last time.

Compare → true or false → if (fork). 75 ≥ 60 → true → pass.

That's how Lessons 6 and 5 connect.
Operators make true or false, and "if" takes it and chooses a path.
One small symbol grows into a program's decision.

05

Hands that make and compare values

Operators are the hands that handle values.
They add to make new values and compare to give true or false.
With these hands, a program calculates and decides.
In the next lesson, we'll see how to have the same thing done many times.

Operator = a symbol to make and compare values
Calculation makes new values · comparison makes true·false. True·false leads to "if."
Loops
The same thing many times
Functions
Bundle it and name it
Beyond
Bigger programs
Next time we will touch "loops," repeating the same thing many times.

Now that you know the symbols, what's next. Operator = a symbol that makes and compares values → loops · functions · beyond.

We've now come as far as naming values (variables), knowing their types (data types), comparing to decide (conditions), and calculating (operators).
With these tools, built up one at a time, we'll go on to make bigger and bigger things.

In one lineOperators are symbols that handle values. Calculating operators make new values, comparing operators give true or false, and that true or false leads to the fork of "if." Small symbols add up to a program's calculations and decisions.
← Programming
Was this helpful? Support seegongsik