A Pocket Guide To Programming Core

Programming Language Types

Programming languages can easily distinguished into two main types as per variable declaration.

  • Strongly Typed
  • Loosely Typed

Strongly Typed

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

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.

Zeeshan Elahi

Hi, I'm Zeeshan Elahi

I've spent 19 years building and looking after websites and web apps that people rely on every day, and I write these guides to share what that work has taught me. If you're building something similar, stuck on a problem, or want a second pair of eyes on your project, I'd be glad to hear about it.

Leave a comment

Your email address will not be published. Required fields are marked *

*

*