Say Hello to Programming: Writing "Hello, World!" in 50 Different Languages
Henry Dioniz
Posted on March 25, 2024
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!")
2 Java:
public class HelloWorld {
public static void main(String[] args) {
System out println("Hello, World!");
}
}
3 C:
#include <stdio h>
int main() {
printf("Hello, World!\n");
return 0;
}
4 C++:
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
5 JavaScript:
console log("Hello, World!");
6 Ruby:
puts "Hello, World!"
7 Swift:
print("Hello, World!")
8 Go:
package main
import "fmt"
func main() {
fmt Println("Hello, World!")
}
9 Rust:
fn main() {
println!("Hello, World!");
}
10 PHP:
<?php
echo "Hello, World!";
?>
11 Perl:
print "Hello, World!\n";
12 Kotlin:
fun main() {
println("Hello, World!")
}
13 Scala:
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello, World!")
}
}
14 Lua:
print("Hello, World!")
15 Haskell:
main :: IO ()
main = putStrLn "Hello, World!"
16 Dart:
void main() {
print('Hello, World!');
}
17 Shell:
echo "Hello, World!"
18 Batch:
@echo off
echo Hello, World!
19 PowerShell:
Write-Output "Hello, World!"
20 VBScript:
MsgBox "Hello, World!"
21 Objective-C:
#import <Foundation/Foundation h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"Hello, World!");
}
return 0;
}
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
23 VBA (Visual Basic for Applications):
Sub HelloWorld()
MsgBox "Hello, World!"
End Sub
24 Tcl:
puts "Hello, World!"
25 COBOL:
IDENTIFICATION DIVISION
PROGRAM-ID HELLO-WORLD
PROCEDURE DIVISION
DISPLAY "Hello, World!"
STOP RUN
26 F#:
printfn "Hello, World!"
27 Elixir:
IO puts "Hello, World!"
28 SQL (MySQL):
SELECT 'Hello, World!';
29 SQL (SQLite):
SELECT 'Hello, World!';
30 SQL (PostgreSQL):
SELECT 'Hello, World!';
31 SQL (Oracle):
SELECT 'Hello, World!' FROM DUAL;
32 SQL (SQL Server):
PRINT 'Hello, World!';
33 Smalltalk:
Transcript show: 'Hello, World!'; cr
34 R:
cat("Hello, World!\n")
35 Bash:
echo "Hello, World!"
36 Erlang:
-module(hello)
-export([hello_world/0])
hello_world() ->
io:fwrite("Hello, World!~n")
37 Julia:
println("Hello, World!")
38 MATLAB:
disp('Hello, World!');
39 AutoHotkey:
MsgBox, Hello, World!
40 Clojure:
(println "Hello, World!")
41 Groovy:
println "Hello, World!"
42 OCaml:
print_endline "Hello, World!"
43 D:
import std stdio;
void main()
{
writeln("Hello, World!");
}
44 Crystal:
puts "Hello, World!"
45 Nim:
echo "Hello, World!"
46 Common Lisp:
(format t "Hello, World!~%")
47 Scheme:
(display "Hello, World!")
(newline)
48 Prolog:
:- initialization(main)
main :-
write('Hello, World!'), nl,
halt
49 ABAP:
REPORT ZHELLO_WORLD
WRITE: / 'Hello, World!'
50 VB NET:
vb net
Module HelloWorld
Sub Main()
Console WriteLine("Hello, World!")
End Sub
End Module
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
Posted on March 25, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
March 25, 2024