Say Hello World in Different Programming Languages

When you learn a new programming language, one of the first programs you learn is how to code, "Hello World!"   Having first been mentioned in Brian Kernighan’s tutorial to the B programming language, it became widely known through Kernighan & Ritchie’s 1978 book that introduced “The C Programming Language”, where it read like this:

main() {
printf("hello, world\n");
}

It is typically one of the simplest programs possible in almost all computer languages. As such it can be used to quickly compare syntax differences between various programming languages. It is also used to verify that a language or system is operating correctly.

Hello World Program in Different Language

Following is a list of "Hello, world"  programs in 24 of the most commonly used programming languages.

1. Hello World in BASH

echo "Hello World."

2. Hello World in C

#include<stdio.h>
int main(void) {
  printf("hello, world\n");
  return 0;
}

3. Hello World in C++

#include<iostream>
int main(void) {
  std::cout<<"hello, world\n";
  return 0;
}

4. Hello World in C#

using System;
class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine("Hello, world!");
    }
}

5. Hello World in Clipper

? "Hello World"

6. Hello World in Coffee Script

console.log 'Hello, world!'

7. Hello World in Delphi

program HelloWorld;
begin
  Writeln('Hello, world!');
end.

8. Hello World in Java

import javax.swing.JFrame;  //Importing class JFrame
import javax.swing.JLabel;  //Importing class JLabel
public class HelloWorld {
    public static void main(String[] args) {
        JFrame frame = new JFrame();           //Creating frame
        frame.setTitle("Hi!");                 //Setting title frame
        frame.add(new JLabel("Hello, world!"));//Adding text to frame
        frame.pack();                          //Setting size to smallest
        frame.setLocationRelativeTo(null);     //Centering frame
        frame.setVisible(true);                //Showing frame
    }
}

9. Hello World in JavaScript

document.write('Hello, world!');

10. Hello World in JQuery

$("body").append("Hello world!");

11. Hello World in Julia

println("Hello world!")

12. Hello World in Logo

print [Hello, world!]

13. Hello World in Matlab

disp('Hello, world!')

14. Hello World in Pascal

program HelloWorld;
  begin
    WriteLn('Hello, world!');
  end.

15. Hello World in Perl5

print "Hello, world!";

16. Hello World in PHP

My first PHP page

 



17. Hello World in Python2

print "Hello, world!"

18. Hello World in Python3

print("Hello, world!")

19. Hello World in R

cat('Hello, world!')

20. Hello World in Ruby

puts "Hello, world!"

21. Hello World in Swift

println("Hello, world!")

22. Hello World in VB Script

MsgBox "Hello, World!"

23. Hello World in Visual Basic .NET

Module Module1
    Sub Main()
        Console.WriteLine("Hello, world!")
    End Sub
End Module

24. Hello World in XSLT

Hello World

This article is contributed by Praveen. If you like eLgo Academy and would like to contribute, you can mail your article to admin@elgoacademy.org. See your article appearing on the eLgo Academy page and help other Geeks. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.