DEV Community

Cover image for 'Hello, World!' in 15 different languages πŸ’₯
Tilak Thapa
Tilak Thapa

Posted on

'Hello, World!' in 15 different languages πŸ’₯

Introduction:

Programming is often seen as a serious and daunting endeavor. However, it doesn't have to be! Today, we're going to take a light-hearted journey into the world of coding by writing the quintessential "Hello, World!" program in not one, not two, but 15 different programming languages. And trust us, it's going to be a rollercoaster ride through the quirky and the downright professional. So, fasten your seatbelts, and let's dive in!

1. Java

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

Java, a versatile and widely-used programming language, starts with the traditional public class HelloWorld.

2. Python

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

Python, known for its simplicity and readability, keeps it short and sweet with just a single line to greet the world.

3. C++

#include <iostream>
using namespace std;

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

C++ takes a more structured approach, with headers and namespaces, but still delivers the iconic message with style.

4. JavaScript

console.log("Hello, World!");
Enter fullscreen mode Exit fullscreen mode

JavaScript, the language of the web, opts for a "log" to the console to announce its presence.

5. C#

using System;

class Program {
    static void Main() {
        Console.WriteLine("Hello, World!");
    }
}
Enter fullscreen mode Exit fullscreen mode

C#, a language for Windows applications, uses a class-based structure to showcase its greeting.

6. SQL

-- SQL doesn't usually say "Hello, World!" but let's break the mold
SELECT 'Hello, World!' AS greeting;
Enter fullscreen mode Exit fullscreen mode

SQL, the language of databases, deviates from the norm by retrieving a message instead of directly printing it.

7. C

#include <stdio.h>

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

Good old C, the foundation of many languages, follows the "printf" tradition to send greetings.

8. PHP

<?php
echo "Hello, World!";
?>
Enter fullscreen mode Exit fullscreen mode

PHP, a web scripting language, wraps its message in PHP tags and employs "echo" to make its introduction.

9. Go

package main

import "fmt"

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

Go, known for its efficiency, utilizes packages and "fmt" to extend a warm welcome.

10. Swift

import Swift

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

Swift, Apple's language for iOS development, imports itself and delivers a swift "print" statement.

11. Kotlin

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

Kotlin, a modern language for Android, keeps it concise and clear with "fun" and "println."

12. Ruby

puts "Hello, World!"
Enter fullscreen mode Exit fullscreen mode

Ruby, beloved for its readability, simply "puts" the message on the screen.

13. TypeScript

console.log("Hello, World!");
Enter fullscreen mode Exit fullscreen mode

TypeScript, a typed superset of JavaScript, sticks to the familiar "console.log" for its greeting.

14. Scala

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

Scala, known for its elegance, introduces an "object" and a "def" to send its warm regards.

15. R

cat("Hello, World!\n")
Enter fullscreen mode Exit fullscreen mode

R, a language for statistical computing, uses "cat" to convey its message with a newline character.

Each of these programming languages may have its own quirks and purposes, but they all unite in the simple act of saying "Hello, World!" It's a testament to the diversity and creativity in the world of coding. So, whether you're a beginner or a seasoned developer, remember that coding can be both serious and fun. Happy coding! πŸš€

Top comments (2)

Collapse
 
karim_abdallah profile image
Karim Abdallah

Kotlin is the best πŸ”₯β™₯️

Collapse
 
dshaw0004 profile image
Dipankar Shaw

Nice