Picture an airline's carry-on rule: at most 7 kg and no longer than 55 cm. The rule doesn't tell you what to pack. It rules out some choices and leaves many allowed. Constraints in mathematics work the same way: w≤7 and L≤55 describe a set of acceptable values, not a single answer.
Some constraints are stated and others come from the situation. With $50 and notebooks at $4, the stated constraint is 4n≤50, so n≤12.5. The hidden ones are that n is a whole number and n≥0. Together they allow n=0,1,2,…,12, so the most you can buy is 12. Each new constraint shrinks the allowed set, and sometimes nothing is left: no number satisfies both x>5 and x<3.
With two variables, a constraint such as x+y≤100 shades a region of the plane: every point on or below the line x+y=100. Several constraints overlap to form a feasible region, and optimization looks for the best point in it, usually on its edge.
An equation does a different job. Spending exactly $48 on $4 notebooks gives 4n=48, which pins down one value, n=12. A constraint says "at most" or "at least"; an equation says "exactly". Replacing ≤ with = throws away every other allowed answer.
Think of it like this. Constraints work like fences around a field: they never say where the sheep must stand, only where it may not go. Each new fence shrinks the field, and badly placed fences can leave no field at all. Unlike a fence, a constraint such as x=0 can remove a single point.
Core idea. A constraint is a condition that fences off which values a variable is permitted to take.