In coding, a constant is a value that remains fixed and unchanging, no matter where it appears or what the program uses it for. A constant is usually declared at the beginning of a program and cannot be altered, unlike a variable, which programmers can edit. Constants can be whole numbers, decimals, fractions, exponents, letters, and symbols. Pi is a popular example of a constant: It will always be 3.14. 

When used properly, constants help explain code to other programmers and streamline the code maintenance process. They also speed up compile time because compilers can check their accuracy faster.

In code, constants appear with the keyword const, but this can vary across different languages. Java, for example, doesn’t use const at all and indicates constants with final instead.

Other glossary terms

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Hmm…we couldn’t find any results. Try a different search term or reset the filter.
Reset the filter
Load more