IT lexicon › Programming › Type annotation

Type annotation

Programming På svenska → Updated: 2026-11-13

Explicit declaration of what type a variable or function has. Common in static type systems.

Type annotation is how you tell the compiler "this variable is an integer" or "this function takes a string and returns a number". Pascal, Ada, and Java use this. In early languages it was mandatory; in modern languages, compilers can often infer the type from context, making annotation optional. It provides both safety and readability.

← Back to the lexicon