What is CONSTANT_CASE?
CONSTANT_CASE writes every word in uppercase and joins them with underscores. It is also known as SCREAMING_SNAKE_CASE, MACRO_CASE or simply upper snake case.
CONSTANT_CASE examples
- hello world example → HELLO_WORLD_EXAMPLE
- max retry count → MAX_RETRY_COUNT
- apiBaseUrl → API_BASE_URL
Where is CONSTANT_CASE used?
CONSTANT_CASE is the convention for constants in C, C++, Java, JavaScript and Python, for preprocessor macros, and above all for environment variables and configuration keys: DATABASE_URL, MAX_RETRY_COUNT, NODE_ENV. Files like .env and CI pipeline configs are full of it.
Why a special case for constants?
The loud style is deliberate: a fully capitalized name stands out in a file and signals "this value is fixed — do not reassign it". The convention goes back to C macros and has been kept by style guides ever since.