Introduction to a programming language
Here you will learn about a programming language ( What they are ?, Why are they necessary ?, Some examples of programming languages and the types of programming language.)
What is a programming language ?
A programming language is a set of instructions written in form of strings to the computer.
Why a programming language ?
A computer cannot simply understand instructions such as subtract 5 from 8
or add 100 and 2
.
So a programming language converts the strings into a computer readable form and executes them.
Types of programming languages
Procedural Programming Language
Functional Programming Language
Scripting Programming Language
Object-Oriented Programming Language
Examples of programming languages
Some examples of programming language are : Python, Javascript, C, C++, Java, Rust, Ruby, Typescript etc.
Hello World program in a few languages :
You can find more here
#include <stdio.h>
int main(void) {
printf("Hello world!\n");
return 0;
}
#include <iostream>
int main(void) {
std::cout << "Hello world!" << std::endl;
return 0;
}
console.log("Hello World")
print("Hello World")
COMMENTS
A comment is used to explain a part of the program to the user. It is generally ignored by compilers and interpreters.
// This is a single line comment
/* This is slightly long
multi line comment*/
#single line comment in Ruby
=begin
This is slightly long
multi line comment in Ruby
=end
– – single line comment in Haskell
{- longer comment :
multi line comment in Haskell -}
#hello comment 1 in python
#comment 2 in python