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.
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.
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.
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.