Statically v. dynamically v. strongly v. weakly typed languages

Statically vs. dynamically typed

Statically-typed programming languages do type checking (i.e., the process of verifying and enforcing the constraints of types on values) at compile-time, whereas dynamically-typed languages do type checks at runtime.

Examples

Statically-typed: C, C++, Java.

Dynamically-typed: Perl, Ruby, Python, PHP, JavaScript.

The Language Cloud. Image Source : Mayank Bhatnagar
The Language Cloud. Image Source : Mayank Bhatnagar

Strongly vs. weakly typed

Weakly-typed languages make conversions between unrelated types implicitly; whereas, strongly-typed languages don’t allow implicit conversions between unrelated types.

Python is a strongly-typed language:

var = 21; #type assigned as int at runtime.
var = var + "dot"; #type-error, string and int cannot be concatenated.
print(var);

JavaScript is a weakly-typed language:

value = 21;
value = value + "dot";
console.log(value);
/*
This code will run without any error. As Javascript
is a weakly-typed language, it allows implicit conversion
between unrelated types.
*/

Free Resources