DEV Community

Cover image for Say Hello to Programming: Writing "Hello, World!" in 50 Different Languages
Henry Dioniz
Henry Dioniz

Posted on

Say Hello to Programming: Writing "Hello, World!" in 50 Different Languages

Description:
In this blog post, we'll explore the fascinating world of programming by learning how to write the classic "Hello, World!" program in 50 different programming languages. From the simplicity of Python to the elegance of Haskell, we'll take a brief tour through a diverse range of languages, each with its own unique syntax and approach to programming. Whether you're a seasoned developer looking to expand your repertoire or a curious beginner eager to dip your toes into the vast ocean of code, this journey promises to be both educational and entertaining.


Now, let's dive into writing "Hello, World!" in 50 different languages:

1 Python:

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

2 Java:

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

3 C:

#include <stdio h>

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

4 C++:

#include <iostream>

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

5 JavaScript:

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

6 Ruby:

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

7 Swift:

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

8 Go:

package main

import "fmt"

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

9 Rust:

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

10 PHP:

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

11 Perl:

print "Hello, World!\n";
Enter fullscreen mode Exit fullscreen mode

12 Kotlin:

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

13 Scala:

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

14 Lua:

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

15 Haskell:

main :: IO ()
main = putStrLn "Hello, World!"
Enter fullscreen mode Exit fullscreen mode

16 Dart:

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

17 Shell:

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

18 Batch:

@echo off
echo Hello, World!
Enter fullscreen mode Exit fullscreen mode

19 PowerShell:

Write-Output "Hello, World!"
Enter fullscreen mode Exit fullscreen mode

20 VBScript:

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

21 Objective-C:

#import <Foundation/Foundation h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSLog(@"Hello, World!");
    }
    return 0;
}
Enter fullscreen mode Exit fullscreen mode

22 Assembly:

section  data
    hello db 'Hello, World!',10
    len equ $ - hello

section  text
    global _start

_start:
    ; write our string to stdout
    mov eax, 4         ; sys_write
    mov ebx, 1         ; file descriptor 1 (stdout)
    mov ecx, hello     ; message to write
    mov edx, len       ; message length
    int 0x80           ; syscall
    ; exit
    mov eax, 1         ; sys_exit
    xor ebx, ebx       ; exit status 0
    int 0x80           ; syscall
Enter fullscreen mode Exit fullscreen mode

23 VBA (Visual Basic for Applications):

Sub HelloWorld()
    MsgBox "Hello, World!"
End Sub
Enter fullscreen mode Exit fullscreen mode

24 Tcl:

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

25 COBOL:

       IDENTIFICATION DIVISION 
       PROGRAM-ID  HELLO-WORLD 
       PROCEDURE DIVISION 
           DISPLAY "Hello, World!" 
           STOP RUN 
Enter fullscreen mode Exit fullscreen mode

26 F#:

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

27 Elixir:

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

28 SQL (MySQL):

SELECT 'Hello, World!';
Enter fullscreen mode Exit fullscreen mode

29 SQL (SQLite):

SELECT 'Hello, World!';
Enter fullscreen mode Exit fullscreen mode

30 SQL (PostgreSQL):

SELECT 'Hello, World!';
Enter fullscreen mode Exit fullscreen mode

31 SQL (Oracle):

SELECT 'Hello, World!' FROM DUAL;
Enter fullscreen mode Exit fullscreen mode

32 SQL (SQL Server):

PRINT 'Hello, World!';
Enter fullscreen mode Exit fullscreen mode

33 Smalltalk:

Transcript show: 'Hello, World!'; cr 
Enter fullscreen mode Exit fullscreen mode

34 R:

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

35 Bash:

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

36 Erlang:

-module(hello) 
-export([hello_world/0]) 

hello_world() ->
    io:fwrite("Hello, World!~n") 
Enter fullscreen mode Exit fullscreen mode

37 Julia:

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

38 MATLAB:

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

39 AutoHotkey:

MsgBox, Hello, World!
Enter fullscreen mode Exit fullscreen mode

40 Clojure:

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

41 Groovy:

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

42 OCaml:

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

43 D:

import std stdio;

void main()
{
    writeln("Hello, World!");
}
Enter fullscreen mode Exit fullscreen mode

44 Crystal:

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

45 Nim:

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

46 Common Lisp:

(format t "Hello, World!~%")
Enter fullscreen mode Exit fullscreen mode

47 Scheme:

(display "Hello, World!")
(newline)
Enter fullscreen mode Exit fullscreen mode

48 Prolog:

:- initialization(main) 

main :-
    write('Hello, World!'), nl,
    halt 
Enter fullscreen mode Exit fullscreen mode

49 ABAP:

REPORT ZHELLO_WORLD 

WRITE: / 'Hello, World!' 
Enter fullscreen mode Exit fullscreen mode

50 VB NET:

vb net
Module HelloWorld
    Sub Main()
        Console WriteLine("Hello, World!")
    End Sub
End Module 
Enter fullscreen mode Exit fullscreen mode

That concludes our journey through "Hello, World!" in 50 different programming languages Whether you're just starting or have been programming for years, exploring different

Top comments (0)