constant

A name for a value that is set once and is not meant to change while the program runs.

In more detail

Constants suit limits and codes that must not change, such as a maximum retry count, and a named constant explains what a bare number means. Some languages enforce constants, as Go does with const, while others such as Python rely on the convention of writing the name in capitals.

Examples

const maxProbes = 3
PI = 3.14159

def circleArea(r):
    return PI * r * r

Related terms

Taught in

References

Certification courses