What is a Programming Language?

When we want for a computer to do something, we need to create a special way of communication between us humans and a computer which understand only electrical pulses.

A programming language is a special language that allows us humans to communicate instructions to computers. Just like we use English, Dutch, or French to communicate with other people, In short: we use programming languages to tell computers what to do.

Programming languages have their own syntax (rules for how to write code) and semantics (what the code means). When you write code in a programming language, you're essentially writing a recipe that tells the computer step-by-step what operations to perform.

Unlike natural language where some words can have different meanings, programming languages are built in a way to be always precise and predictable.

Here is an example of how a programming language can look like:

const n = parseInt(prompt("Enter a number:"), 10);

if (n > 0) {
  for (let i = 1; i <= n; i++) {
    console.log(i);
  }
} else {
  console.log("Please enter a positive number.");
}

The code above was written in the JavaScript programming language. It may look complicated and scary at first, but with a bit of reading and practice you will be able to read this code snippet easily.

Some common programming languages include:

<aside> 💡

No programming language is better than another. Each language has its strengths and is suited for different types of tasks, but they all share the same fundamental concepts of programming.

</aside>

Here is another example of a programming language called Python:

n = int(input("Enter a number: "))

if n > 0:
    for i in range(1, n + 1):
        print(i, end=" ")
    print()
else:
    print("Please enter a positive number.")

What differences do you see between Python and the first example in JavaScript?