UnicMinds

StronglyTypedvsWeaklyTypedCodingLanguages

Strongly typed vs. Weakly typed Programming Languages

Programming Languages are of two types – strongly typed and weakly typed. Certain languages like JavaScript and PHP are called weakly typed languages. This means that when you create a variable in either language, you do not need to assign its data type (like whether it is integer, string or float) specifically; it is assumed by the programming language. So, you can write the following in JavaScript.

var x2 = ‘This is a beautiful world’;

var x1 = 5;

let y = ‘It is a beautiful sunny day’;

Whereas in a strongly typed language like C or Java, you have to clearly define your datatype of variable.

For example: 

int x1 = 2;

String x2 = “It is a beautiful day”;

You see the difference, you’ve to explicitly mention whether the variables x1 and x2 are integers or strings. You don’t need to do that in JavaScript or in other weakly typed languages.

Assigning one type of datatype to another creates later in the program is not a clean and efficient way to write your programs and will lead to ‘Warnings’ while executing the programs in weakly (or loosely) typed languages. In strongly typed languages, this will lead to errors in the program while compilation.

coding for kids

So children, whenever your learning a new programming language, it is important to understand if it is a weakly typed programming language or a strongly typed program language. So, google and find out if the following languages are strongly typed or weakly typed: Perl, PHP, Python, C#, and Typescript.

Hope this is useful, thank you.

You may like to read: Parts of a Computer, Python for Kids, and What are Compilers, Assemblers, Loaders, and Linkers?

BOOK A FREE TRIAL