Lesson 29: Using = Assignment Arithmetic Operator
Learn how = assigns values, updates variables, and how it differs from == comparison.
Lesson Template
Practice arithmetic, comparison, and logical operators.
This lesson introduces the core ideas behind Operators.
int pwm = sensorValue / 16;
if (pwm > 128 && enabled) {
// ...
}Learn how = assigns values, updates variables, and how it differs from == comparison.
Learn how + adds values, works with different data types, and how it differs from += updates.
Learn how - subtracts values, works with multiple data types, and how it differs from -= updates.
Learn how * multiplies values, works with multiple data types, and how it differs from *= updates.
Learn how / divides values, including integer vs float division, and how it differs from /= updates.
Learn how % returns division remainder and how to use it for even/odd and periodic logic.
Learn how && combines multiple conditions so code runs only when every required check is true.
Learn how ! inverts boolean results, simplifies conditions, and improves active-low logic clarity.
Learn how || returns true when any condition is true and helps build flexible trigger logic.
Learn how == compares values, returns true/false, and controls decision branches.
Learn how > evaluates thresholds and triggers logic when values exceed limits.
Learn how >= handles inclusive thresholds so equal values also pass comparison checks.
Learn how < checks strict lower-than conditions and how it differs from <= in threshold logic.
Learn how <= includes boundary values so equal and lower values pass in threshold checks.
Learn how != detects mismatched values and helps build state-change logic.
Learn how += updates variables in one step for counters, totals, and loop-based increments.
Learn how -= updates variables in one step for countdowns, reducing delays, and step-down loops.
Learn how *= updates variables in one step for scaling values and growth patterns in loops.
Learn how /= updates variables in one step for reducing values and scaling down loop behavior.
Learn how %= updates variables in one step using remainder logic for wrap-around counters and repeating patterns.
Learn how &= keeps selected bits and clears others using masks for safe flag handling.
Learn how |= sets selected bits with masks while preserving existing bits in flag variables.
Learn how ^= toggles selected bits using masks for alternating states and flag flipping logic.
Learn how ++ increments values by one, including pre/post increment behavior in loops and counters.
Learn how -- decrements values by one, including pre/post decrement behavior in loops and countdowns.
Learn how << shifts bits left, multiplies by powers of two, and supports mask-based embedded logic.
Learn how >> shifts bits right, divides by powers of two, and supports bit-mask style embedded logic.
Learn how & compares bits, filters with masks, and extracts useful flags from packed values.
Learn how | combines bits with masks, sets flags, and supports low-level embedded control.
Learn how ^ compares bit differences, toggles selected bits, and supports efficient state flipping.
Learn how ~ flips every bit, how inversion affects values, and when to use it safely with masks.