Skip to content
BENIBIX Learn

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.

Development🔤 Languages

Statically Typed Language

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

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.
Why it matters
Type checks catch a whole class of bugs early. They also help editors suggest the right names.
Full entry
Development🔤 Languages

Dynamically Typed Language

A language that checks types as the code runs, not before.

A dynamically typed language works out each value's type while the program runs. A variable can hold a number now and text later. You write less, and you can try ideas fast. The catch is that a type mistake only shows up when that line runs, maybe in front of a user. Python, JavaScript, Ruby and PHP work this way.

Example
Emma stores 30 in age, then "thirty". Python is fine with both, so the slip only shows when she tries to add 1.
Why it matters
Quick to write, so it suits scripts and early ideas. Big projects often add type checks later.
Full entry

In one line

Statically Typed Language
A language that checks the type of each value before it runs.
Dynamically Typed Language
A language that checks types as the code runs, not before.