← Back to Programming Fundamentals
06

Operators and Expressions: Turning Data into Useful Results

Learn how to add, compare, and combine values with basic operators so your variables stop being passive storage and start producing real results inside the program.

📘 Theory

What Operators Are and Why They Matter

An operator tells the program what to do with the values it already has.

If you have a price and a shipping cost, you need to add them to get a total. If you have an age and a minimum access rule, you need to compare them. If you have two conditions, you may need to combine them.

In all of those cases, operators turn loose data into decisions, checks, or results the program can use.

  • Operators work on values and variables.
  • An expression is the result of combining those pieces with meaning.
  • Reading an expression well is as important as writing it.

Arithmetic Operators: Calculate Without Losing Context

The first operators you will use again and again are the ones that work with quantities.

  • `+` adds numeric values.
  • `-` subtracts one value from another.
  • `*` multiplies quantities.
  • `/` divides one value by another.

Comparison Operators: Producing Yes-or-No Results

Comparison is the bridge between raw data and the decisions your program will make later.

The result of these expressions is not a strange keyword. It is a boolean: `true` or `false`.

That prepares the ground for the next lessons, where these results will start controlling different paths in the program.

  • `>` and `` compare greater than or less than.
  • `>=` and `=` include equality.
  • `===` checks strict equality.
  • `!==` checks whether two values are different.

Logical Operators: Combining Simple Conditions

When one check is not enough, logical operators let you combine rules.

  • `&&` requires both conditions to be true.
  • `||` allows at least one condition to be true.
  • `!` reverses a boolean value.

🧭 Key visuals

From variables to results through operators

It helps learners see that an expression transforms input values into useful results that can feed later decisions.

A teaching diagram showing how variables go through arithmetic, comparison, and logical operators to produce numeric or boolean results.

🧪 Learn by doing

Example Guided Example: Calculate a Total Combine two numeric values to produce a useful result inside the program.

🏁 Challenges

Challenge Challenge: Create a Free-Shipping Rule Calculate a total and check whether it reaches the minimum for free shipping.

🧰 Resources

What is this?

I'm Cristian Eslava and I sometimes build websites so both you and I can learn and experiment. culTest

I made this in February 2026 to make learning easier for my students. The idea is to learn web development by practicing and to keep expanding the project with new topics, tests and challenges.

It draws inspiration from MDN, W3Schools, CodePen, Manz and many other web development references. I wanted to combine useful theory, runnable examples, challenges and the testing system I had already built for culTest. culTest

If you liked it, if you didn't, or if you want to get in touch, write to me at cristianeslava@gmail.com