DEV Community

Fadi Nouh
Fadi Nouh

Posted on

"Hello, World!" in 20 Popular Programming Languages

When I start learning any programming language, the first example I get from the tutorial is : let's print "Hello World!".
This exercise in every tutorial is considered to be one of the simplest programs possible in almost all languages.

In this article, you'll learn how to write the "Hello, World!" program in the top 20 most popular programming languages.

01. "Hello World" Program in JavaScript

Of course I would start from a language which I know already.

<script>
  console.log('Hello, World!');
</script>
Enter fullscreen mode Exit fullscreen mode

02. "Hello World" Program in Python

Python is also one of the most popular programming languages. It's used for software development, system scripting, web development

print("Hello, World!")
Enter fullscreen mode Exit fullscreen mode

03. "Hello World" Program in Java

Java is a high-level, class-based, and object-oriented programming language.

class HelloWorld {
 public static void main(String args[]) {
    System.out.println("Hello, World!");
 }
}
Enter fullscreen mode Exit fullscreen mode

04. "Hello World" Program in Kotlin

Kotlin is primarily used for android development.

fun main(args: Array<String>) {
 println("Hello, World!")
}
Enter fullscreen mode Exit fullscreen mode

05. "Hello World" Program in PHP

PHP is an a scripting language, It's used to develop websites and web apps.

<!DOCTYPE html>
  <html>
    <head>
      <title> </title>
    </head>
    <body>

      <?php
       echo "Hello, World!";
      ?>

    </body>
  </html>
Enter fullscreen mode Exit fullscreen mode

06. "Hello World" Program in "C#"

C# is used to develop desktop applications, web applications, and web services. It's also used in game development.

namespace HelloWorld
{
 class Hello { 
    static void Main(string[] args) 
    {
       System.Console.WriteLine("Hello, World!");
    }
 }
}
Enter fullscreen mode Exit fullscreen mode

07. "Hello World" Program in Swift

Swift was created by Apple in 2014. It's a general-purpose programming language for the Apple ecosystem.

print("Hello, World!")
Enter fullscreen mode Exit fullscreen mode

08. "Hello World" Program in C++

C++ is a general-purpose object-oriented programming language created by Bjarne Stroustrup. It's widely used to develop operating systems, browsers, games, etc.

#include <iostream>
using namespace std;
int main()
{
 cout << "Hello, World!";
 return 0;
}
Enter fullscreen mode Exit fullscreen mode

09. "Hello World" Program in C

C is used to develop software like operating systems, databases, compilers, etc.

#include <stdio.h>

int main()
{
 printf("Hello, World!");
 return 0;
}
Enter fullscreen mode Exit fullscreen mode

10. "Hello World" Program in Matlab

MATLAB is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks.

disp('Hello, World!');
Enter fullscreen mode Exit fullscreen mode

11. "Hello World" Program in R

R is a programming language and free software environment for statistical computing and graphics supported by the R Core Team and the R Foundation for Statistical Computing.

cat('Hello, World!')
Enter fullscreen mode Exit fullscreen mode

12. "Hello World" Program in Rub

Ruby is an interpreted, high-level, general-purpose programming language.

cat('Hello, World!')
Enter fullscreen mode Exit fullscreen mode

13. "Hello World" Program in Rust

Rust is an open-source systems programming language that focuses on speed, memory safety and parallelism. Developers are using Rust to create a wide range of new software applications, such as game engines, operating systems, file systems, browser components and simulation engines for virtual reality.

fn main() {
 println!("Hello, World!");
}
Enter fullscreen mode Exit fullscreen mode

14. "Hello World" Program in TypeScript

TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language.

let message: string = 'Hello, World!';
console.log(message);
Enter fullscreen mode Exit fullscreen mode

15. "Hello World" Program in Perl

Perl is a general-purpose coding language used for text manipulation, system administration, web development, network programming, GUI development, etc.

#!/usr/bin/perl
use strict;
use warnings;
print("Hello, World!");
Enter fullscreen mode Exit fullscreen mode

16. "Hello World" Program in Scala

Scala is a high-level language that combines the features of object-oriented and functional programming in one language.

object Hello {
 def main(args: Array[String]) = {
 println("Hello, World!")
 }
}
Enter fullscreen mode Exit fullscreen mode

17. "Hello World" Program in Dart

Dart is a general-purpose, object-oriented, class-based, garbage-collected language with C-style syntax. It was created by Google in 2011

void main() {
 print('Hello, World!');
}
Enter fullscreen mode Exit fullscreen mode

18. "Hello World" Program in Solidity

Solidity is an object-oriented programming language for writing smart contracts. It is used for implementing smart contracts on various blockchain platforms, most notably, Ethereum.

pragma solidity ^0.4.22;
contract helloWorld {
 function renderHelloWorld () public pure returns (string) {
 return 'Hello, World!';
 }
}
Enter fullscreen mode Exit fullscreen mode

19. "Hello World" Program in Go

Go is a statically typed, compiled programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson.

package main
import "fmt"

func main() {
 fmt.Println("Hello, World!")
}
Enter fullscreen mode Exit fullscreen mode

20. "Hello World" Program in Julia

Julia is a high-performance, high-level, open-source, dynamically-typed programming language. Julia was created by combining the powerful features of other programming languages like C, Ruby, Lisp, Matlab, Python, R, and Perl.

println("Hello, World!")
Enter fullscreen mode Exit fullscreen mode

Oldest comments (11)

Collapse
 
kkrypt0nn profile image
Krypton • Edited

You've forgotten the "#" on the title of the number 6 ;)
And on the number 19 it should be "Go" in the title :)

Collapse
 
fadinouh1 profile image
Fadi Nouh

I fixed that , thank you for your feedback :)

Collapse
 
aminmansuri profile image
hidden_dude

Transcript show: "Hello world!".

Collapse
 
aminmansuri profile image
hidden_dude • Edited

Frankly we have to come up with a better intro program than "Hello World".

Long gone are the days when printing something on the terminal meant something or was exciting.

Today's basic program should be something like draw a square on the screen. Then we shift the focus towards terminal programing to something more real for this era like the browser, a window, a mobile app, or a something else. Even on the terminal it's possible.

Here's a box in logo:

repeat 4 [ fd 100 rt 90 ]

Collapse
 
satyavvd profile image
satyavvd

Why #15, #16 both Perl??

Collapse
 
fadinouh1 profile image
Fadi Nouh

I fixed that , thank you for your feedback :)

Collapse
 
mpotane profile image
mpotane

Typo number 12 word Ruby

Collapse
 
lexiebkm profile image
Alexander B.K.

In stead of printing "Hello World", I write like the following :

package main
import "fmt"

func main() {
fmt.Println("I am learning Go aka Golang")
}

That is what I do with other programming language like Dart with Flutter or React Native.

Collapse
 
lexiebkm profile image
Alexander B.K.

I wish you would include "Hello World" in Assembly language, esp for Intel 8086 family or Motorola. :)

Collapse
 
ivanilagan11 profile image
Genesis Ivan Ilagan

I think for Ruby in #12 should be:

print "Hello, World!"

:)

Collapse
 
lexiebkm profile image
Alexander B.K.

The 1st programming language that gave me money would output the same result with the following :
@2, 10 say "Hello World"
:)

Sadly, now that language is extinct, like the then loved language which would produce the same result with :
Begin
writeLn("Hello World");
End