Greetings!! from this blog post, I am starting a new series called the "Basics of Code 5 Different Languages" in this series as the title says we are going to study all the beginner concepts that are necessary to start with code ex. variables, functions, loops, conditionals in 5 different programming languages namely: Python π, Java βοΈ, C/C++ (Both are basically the same), C# and Javascript (yes, Java and Javascript are different)
In this post, we will be learning the clichΓ© "printing the Hello World to the console" in the above-mentioned programming languages
Python π
Python, O Python Near and Dear to my Heart β€οΈ - Nibodh Daware
Python was actually the first programming language that introduced me to this amazing world of programming
Python among all is the most understandable and easy syntax
Create a hello.py
file and put the below code in it.
print("Hello World!")
That's it no semicolons no weird things like importing a print statement from classes inside of classes just plain simple print Hello World. This is the simplicity that python really is famous for.
Now let's move on to the weird parts,
Java βοΈ
BEAN LANGUAGE IS NEXT...π₯π₯π₯
I haven't programmed in Java for a while last time I did I remember I was trying to make Minecraft mods but never got into my head
I have heard a lot of praise from people who choose Java as their first language that it has basically changed their lives so I don't know.
Create a hello.java
file and put the below code in it.
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Even though it has a long syntax but I love the fact that it was made with Object-Oriented Programming concepts in mind, and I think it is so good for so many people like the fact that it has so many better features as compared to the previous generation languages like C++.
C#\
Took me a long time to learn how to escape the # in markdown.
As you may have guessed I have tried C#\ too as I am way too predictable it was in theory my first language as nearly everybody wanted to get into programming because of games and what better way to make games than Unity and C#
Create a hello.cs
file and put the below code in it.
namespace HelloWorld
{
class Hello {
static void Main(string[] args)
{
System.Console.WriteLine("Hello World!");
}
}
}
Looks really similar to Java in my opinion.
C/C++
Origin of all!!!!
I can't much about it except I have to learn it in college and I don't think it will stop haunting my back anytime soon. I'm kidding I like C.
This is Hello World in C:
Create a hello.c
file and put the below code in it.
#include <stdio.h>
void main(){
printf("Hello World");
}
and this in C++
Create a hello.cpp
file and put the below code in it.
#include <iostream>
using namespace std;
int main(){
cout << "Hello World" << endl;
return 0;
}
There are also other ways but this is how I like to write it.
Javascript βοΈπ
Best for beginners
This is also one of my favourite languages out of all the languages I touched the past year. If I start I am not going to stop talking so let's write the Hello World
Create a hello.js
file and put the below code in it.
console.log("Hello World");
By now you may know I like simple and easy languages. Here the console doesn't mean by the native command line but the browser inspect window.
Conclusion
Choosing your first language is really important as it will predict your experience in this journey.
All the languages that I have introduced you in this post you can't go wrong with them. I may recommend you to find out more about what these languages can do and then choose one of them.