Lesson Template

Operators

Practice arithmetic, comparison, and logical operators.

Progress

6% completed

Lesson Overview

This lesson introduces the core ideas behind Operators.

  • +
  • -
  • *
  • /
  • == and !=
  • && and ||

Example Code

int pwm = sensorValue / 16;
if (pwm > 128 && enabled) {
  // ...
}

Lessons in This Section

Lesson 29: Using = Assignment Arithmetic Operator

Learn how = assigns values, updates variables, and how it differs from == comparison.

Open Lesson

Lesson 30: Using + Addition Arithmetic Operator

Learn how + adds values, works with different data types, and how it differs from += updates.

Open Lesson

Lesson 31: Using - Subtraction Arithmetic Operator

Learn how - subtracts values, works with multiple data types, and how it differs from -= updates.

Open Lesson

Lesson 32: Using * Multiplication Arithmetic Operator

Learn how * multiplies values, works with multiple data types, and how it differs from *= updates.

Open Lesson

Lesson 33: Using / Division Arithmetic Operator

Learn how / divides values, including integer vs float division, and how it differs from /= updates.

Open Lesson

Lesson 34: Using % Remainder Arithmetic Operator

Learn how % returns division remainder and how to use it for even/odd and periodic logic.

Open Lesson

Lesson 35: Using && Logical AND Boolean Operator

Learn how && combines multiple conditions so code runs only when every required check is true.

Open Lesson

Lesson 36: Using ! Logical NOT Boolean Operator

Learn how ! inverts boolean results, simplifies conditions, and improves active-low logic clarity.

Open Lesson

Lesson 37: Using || Logical OR Boolean Operator

Learn how || returns true when any condition is true and helps build flexible trigger logic.

Open Lesson

Lesson 38: Using == Equal To Comparison Operator

Learn how == compares values, returns true/false, and controls decision branches.

Open Lesson

Lesson 39: Using > Greater Than Comparison Operator

Learn how > evaluates thresholds and triggers logic when values exceed limits.

Open Lesson

Lesson 40: Using >= Greater Than or Equal To Comparison Operator

Learn how >= handles inclusive thresholds so equal values also pass comparison checks.

Open Lesson

Lesson 41: Using < Less Than Comparison Operator

Learn how < checks strict lower-than conditions and how it differs from <= in threshold logic.

Open Lesson

Lesson 42: Using <= Less Than or Equal To Comparison Operator

Learn how <= includes boundary values so equal and lower values pass in threshold checks.

Open Lesson

Lesson 43: Using != Not Equal To Comparison Operator

Learn how != detects mismatched values and helps build state-change logic.

Open Lesson

Lesson 44: Using += Compound Addition Operator

Learn how += updates variables in one step for counters, totals, and loop-based increments.

Open Lesson

Lesson 45: Using -= Compound Subtraction Operator

Learn how -= updates variables in one step for countdowns, reducing delays, and step-down loops.

Open Lesson

Lesson 46: Using *= Compound Multiplication Operator

Learn how *= updates variables in one step for scaling values and growth patterns in loops.

Open Lesson

Lesson 47: Using /= Compound Division Operator

Learn how /= updates variables in one step for reducing values and scaling down loop behavior.

Open Lesson

Lesson 48: Using %= Compound Remainder Operator

Learn how %= updates variables in one step using remainder logic for wrap-around counters and repeating patterns.

Open Lesson

Lesson 49: Using &= Compound Bitwise AND Operator

Learn how &= keeps selected bits and clears others using masks for safe flag handling.

Open Lesson

Lesson 50: Using |= Compound Bitwise OR Operator

Learn how |= sets selected bits with masks while preserving existing bits in flag variables.

Open Lesson

Lesson 51: Using ^= Compound Bitwise XOR Operator

Learn how ^= toggles selected bits using masks for alternating states and flag flipping logic.

Open Lesson

Lesson 52: Using ++ Increment Operator

Learn how ++ increments values by one, including pre/post increment behavior in loops and counters.

Open Lesson

Lesson 53: Using -- Decrement Operator

Learn how -- decrements values by one, including pre/post decrement behavior in loops and countdowns.

Open Lesson

Lesson 54: Using << Bitshift Left Operator

Learn how << shifts bits left, multiplies by powers of two, and supports mask-based embedded logic.

Open Lesson

Lesson 55: Using >> Bitshift Right Operator

Learn how >> shifts bits right, divides by powers of two, and supports bit-mask style embedded logic.

Open Lesson

Lesson 56: Using & Bitwise AND Operator

Learn how & compares bits, filters with masks, and extracts useful flags from packed values.

Open Lesson

Lesson 57: Using | Bitwise OR Operator

Learn how | combines bits with masks, sets flags, and supports low-level embedded control.

Open Lesson

Lesson 58: Using ^ Bitwise XOR Operator

Learn how ^ compares bit differences, toggles selected bits, and supports efficient state flipping.

Open Lesson

Lesson 59: Using ~ Bitwise NOT Operator

Learn how ~ flips every bit, how inversion affects values, and when to use it safely with masks.

Open Lesson