LexBrew
Usage Entry 1459 / 1605 60-second read

Variable vs. Constant

A value that can change versus a value that does not.

The comparisoni

✗ Wrong

Pi is a variable — it never changes.

✓ Correct

Pi is a constant — it never changes (3.14159...). VARIABLES change; CONSTANTS don't.

The ruleii

VARIABLE = changes. CONSTANT = fixed.

In math and code, a VARIABLE holds a value that may change. A CONSTANT holds a value that doesn't. Pi, e, the speed of light — physical constants. x, y, n — typical variables.

Memory aidiii

Remember it like this

Variables vary. Constants stay.

You might also like 6 related
↑↓Navigate Open EscClose All results →