DEV Community

Cover image for Hello World! in 5 Different Programming languages
Nibodh Daware
Nibodh Daware

Posted on • Updated on • Originally published at nibodhdaware.me

Hello World! in 5 Different Programming languages

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!")
Enter fullscreen mode Exit fullscreen mode

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!"); 
    }
}
Enter fullscreen mode Exit fullscreen mode

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 la#nguages 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!");
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

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");
}
Enter fullscreen mode Exit fullscreen mode

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;
}
Enter fullscreen mode Exit fullscreen mode

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");
Enter fullscreen mode Exit fullscreen mode

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.

image.png

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.

Top comments (1)

Collapse
 
aniket762 profile image
Aniket Pal

Nice one! 🔥