Skip to content
Strong vs Weak Typing — Explained with Examples

Strong vs Weak Typing — Explained with Examples

DodaTech Updated Jun 15, 2026 2 min read

Strong typing means that the language strictly enforces type rules and does not allow implicit type conversions that might lose information or produce unexpected results. Weak typing (also called loose typing) permits automatic type coercion between unrelated types, often with surprising behavior.

Strong typing catches type mismatches at compile (or runtime) and prevents operations like adding a string to a number unless explicitly converted. Weak typing allows such operations, which can be convenient but leads to subtle bugs. The distinction is independent of Static vs Dynamic Typing: Python is strongly but dynamically typed (no "5" + 3), while C is weakly but statically typed (you can implicitly convert a pointer to an int).

Real-world analogy. Strong typing is a high-security airport: you cannot board a flight to Paris with a ticket to Tokyo, even if you argue they’re both “travel documents.” Weak typing is a local bus: the driver lets you on with any ticket, and the system just figures it out — but occasionally you end up in the wrong part of town.

Example (Strong — Python):

result = "5" + 3  # TypeError: can only concatenate str (not "int") to str

Example (Weak — JavaScript):

let result = "5" + 3;  // "53" (number coerced to string)
let result2 = "5" - 3; // 2 (string coerced to number)

Related terms: Static vs Dynamic Typing, Transpiler, Compiled vs Interpreted, Type System, Language Safety

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro