Programming languages can easily distinguished into two main types as per variable declaration.
Strongly typed languages are those that strictly need or require variable type declaration at time of declaring a variable. For example.
// Java
String name = "John Doe";
// C++
string name = "John Doe";
// C#
string name = "John Doe";
All above variable declarations in Java, C++ and C# will be incorrect if we remove or don’t use “String” at start our statement.
Loosely typed languages are opposite of strongly typed languages. As they allow you to declare a variable without telling or adding variable type at time of declaration. For example.
// PHP
$name = "John Doe";
// JavaScript
var name = "John Doe";
# Python
name = 'John Doe'
Almost all loosely typed languages determine variable type using information stored in a variable or the way we declare a variable. For example.
// A variable of type string should have "" around it in PHP
$name = "John Doe";
// PHP Integer
$age = 16;
$year = 2020;
# In Python we use ''
name = 'John Doe';
# Python Integer
age = 16;
year = 2020;
// JavaScript support both "" and ''
var name = "John Doe";
var name = 'John Doe';
// JavaScript Integer
var age = 16;
var year = 2020;
Now you should know difference between Strongly typed and Loosely typed programming languages.
Let’s move on to next chapter of this course. Please click on “Next” to continue.
Or email me at zeeshan.elahi83@gmail.com