# Statically Typed Language

> A language that checks the type of each value before it runs.

**Field:** Software Development  
**Category:** Languages  
**Also known as:** Static Typing, Statically Typed

## Think of it like

Think of it like jars with labels. The sugar jar only takes sugar, and you find out at once if you pour in salt.

## Definition

A statically typed language checks the type of every value before the program runs. Each variable has a fixed type, like number or text. If you put the wrong kind of value in, you get an error while building, not while the app is in use. Java, C, Rust, Go and TypeScript work this way. It takes a bit more typing, but many bugs never reach users.

## Example

Jack says age is a number, then tries to store the text "thirty" in it. TypeScript stops him before the code ever runs.

## Example code

```typescript
let age: number = 30;
age = "thirty";
// error TS2322: Type 'string' is not assignable to type 'number'.
```

The mistake is caught while checking, before a single line runs.

## Why it matters

Type checks catch a whole class of bugs early. They also help editors suggest the right names.

## Common mistake

Thinking static types mean no bugs. They catch wrong kinds of value, not wrong logic.

## Three principles

- **Checked first.** Types are tested before the code runs.
- **Fixed types.** A number box stays a number box.
- **Fewer surprises.** Type slips never reach the user.

## Related terms

- [Dynamically Typed Language](https://learn.benibix.com/term/development/dynamically-typed-language)
- [Data Type](https://learn.benibix.com/term/development/data-type)
- [TypeScript](https://learn.benibix.com/term/development/typescript)
- [Compiled Language](https://learn.benibix.com/term/development/compiled-language)
- [Solidity](https://learn.benibix.com/term/development/solidity)
- [Strongly Typed Language](https://learn.benibix.com/term/development/strongly-typed-language)

## Told apart from

- [Static vs Dynamic Typing](https://learn.benibix.com/compare/static-vs-dynamic-typing): Both kinds have types. A static language checks them before the code runs; a dynamic one waits until each line runs.
- [Strongly Typed vs Statically Typed](https://learn.benibix.com/compare/strongly-typed-vs-statically-typed): People think strongly typed and statically typed mean the same thing, and they do not. Static or dynamic is about when types are checked: before the program runs, or while it runs. Strong or weak is about how strict the check is: does it refuse to mix a word and a number, or quietly join them? Python is strong but dynamic. C is static but fairly weak.

## Taught in

- [Static and Dynamic Typing](https://learn.benibix.com/learn/development-languages/static-and-dynamic-typing): Programming Languages, 3/12

---

Source: https://learn.benibix.com/term/development/statically-typed-language
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
