Home Hello World
Post
Cancel

Hello World

Introduction

So I created blog using GitHub Pages. My plan is to use this blog as a place to write about topics that I studied/learned about, and other random stuff. Most of the time I’ll probably post stuff related to computer science and math, but I can’t be sure.

Here are a few things I want to mention:

  • I wasn’t able to enable comments, but I am trying.
  • English is not my native language, and there could be multiple grammatical errors. Please ignore for the tume being.

Currently I don’t have anything interesting to post about, but at the same time want to write something, so I’ll just show Hello World written in multiple differnt languages, in no particular order (I’ll keep adding more if I feel like it).

Current Language Count: 50

C

1
2
3
4
5
6
#include <stdio.h>

int main(){
  printf("Hello World");
  return 0;
}

C++

1
2
3
4
5
6
#include <iostream>

int main(){
  std::cout << "Hello World";
  return 0;
}

C#

1
2
3
4
5
6
7
8
namespace HelloWorld
{
  class HW{
    static void Main(string[] args){
      System.console.WriteLine("Hello World");
    }
  }
}

Python

1
print("Hello World")

Java

1
2
3
4
5
class HelloWorld{
  public static void main(String[] args){
    System.out.println("Hello World");
  }
}

JavaScript

1
console.log("Hello World");

Pascal

1
2
3
4
5
program Hello;
begin
  writeln('Hello World');
  readln;
end.

Ruby

1
puts 'Hello World'

Kotlin

1
2
3
fun main(args: Array<String>){
  println("Hello World");
}

Haskell

1
2
3
module Main where

main = putStrLn "Hello World"

Swift

1
println("Hello World");

Node.js

1
2
3
4
5
6
var http = require('http');

http.createServer(function (req,res){
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.end('Hello World');
}).listen(8080);

Text

1
Hello World

Go

1
2
3
4
5
6
7
package main

import "fmt"

func main(){
  fmt.Println("Hello World")
}

D

1
2
3
4
5
import std.stdio;

void main(){
  writeln("Hello World");
}

PHP

1
echo "Hello World";

Rust

1
2
3
fn main(){
  println!("Hello World");
}

Scala

1
2
3
object HelloWorld exends App{
  printIn("Hello World")
}

Lua

1
print("Hello World")

Perl

1
print("Hello World");

F#

1
printfn "Hello World"

Visual Basic

1
2
3
4
5
6
7
8
Import System

Module Module1
  Sub Main()
    Console.WriteLine("Hello World")
    Console.Readline()
  End Sub
End Module

Objective-C

1
2
3
4
5
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]){
    NSLog(@"Hello World");
}

Objective-C++

1
2
3
4
5
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]){
    NSLog(@"Hello World");
}

Golfscript

1
'Hello World'

TypeScript

1
console.log('Hello World');

Assembly

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
global _start

section .text

_start:
  mov rax, 1      ; write(
  mov rdi, 1      ;   STDOUT_FILENO,
  mov rsi, msg    ;   "Hello World",
  mov rdx, msglen ;   sizeof("Hello World")
  syscall         ; );
  
  mov rax, 60     ; exit(
  mov rdi, 0      ;   EXIT_SUCCESS
  syscall         ; );

sectio .rodata
  msg: db "Hello World", 10
  msglen: equ $ - msg

Bash

1
echo "Hello World"

Fortran

1
2
3
program helloworld
  print *, "Hello World"
end program helloworld

Scheme

1
2
3
(begin
  (display "Hello World")
  (newline))

Ada

1
2
3
4
5
6
with Ada.Text_IO;

procedure Hello_World is
begin
  Ada.Text_IO.Put_Line ("Hello World");
end Hello_World;

awk

1
awk 'BEGIN {print "Hello World"}'

OCaml

1
print_string "Hello World"

Brainfuck

1
2
++++++++++[>+++++++>++++++++++>+++<<<-]>++.>+.+++++++
..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.

Whitespace

Space, Tab, Linefeed character is shown with the identifying comment “S”,”T”, or “L” respectively.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
S S S T	S S T S S S L
T	L
S S S S S T	T	S S T	S T	L
T	L
S S S S S T	T	S T	T	S S L
T	L
S S S S S T	T	S T	T	S S L
T	L
S S S S S T	T	S T	T	T	T	L
T	L
S S S S S T	S T	T	S S L
T	L
S S S S S T	S S S S S L
T	L
S S S S S T	T	T	S T	T	T	L
T	L
S S S S S T	T	S T	T	T	T	L
T	L
S S S S S T	T	T	S S T	S L
T	L
S S S S S T	T	S T	T	S S L
T	L
S S S S S T	T	S S T	S S L
T	L
S S S S S T	S S S S T	L
T	L
S S L
L
L

Without comments, the code above would look something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
           
  
              
  
              
  
              
  
                
  
            
  
           
  
                
  
                
  
               
  
              
  
              
  
            
  
  


R

1
print("Hello World", quote=FALSE)

Tcl

1
puts "Hello World"

Rhino

1
print("Hello World")

Cobol

1
2
3
4
IDENTIFICATION DIVISION.
PROGRAM-ID. Hello-world.
PROCEDURE DIVISION.
  DISPLAY "Hello World".

Pike

1
2
3
4
int main(){
  write("Hello World");
  return 0;
}

Sed

1
echo "Hello sed" | sed 's/sed/World/'

INTERCAL

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
DO ,1 <- #13
PLEASE DO ,1 SUB #1 <- #238
DO ,1 SUB #2 <- #108
DO ,1 SUB #3 <- #112
DO ,1 SUB #4 <- #0
DO ,1 SUB #5 <- #64
DO ,1 SUB #6 <- #194
DO ,1 SUB #7 <- #48
PLEASE DO ,1 SUB #8 <- #22
DO ,1 SUB #9 <- #248
DO ,1 SUB #10 <- #168
DO ,1 SUB #11 <- #24
DO ,1 SUB #12 <- #16
DO ,1 SUB #13 <- #162
PLEASE READ OUT 1,
PLEASE GIVE UP

bc

1
print "Hello World";

Algol

1
BEGIN DISPLAY("Hello World") END.

Befunge

1
2
3
"dlroW olleH"> , v
             | : <
             @

FreeBASIC

1
2
3
4
5
Option Explicit
Cls
Print "Hello World"
Sleep
End

Haxe

1
2
3
4
5
class Text{
  static function main(){
    trace("Hello World");
  }
}

LOLCODE

1
2
3
4
HAI 1.2
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE

SystemVerilog

1
2
3
4
5
module test;
  initial begin
    $display("Hello World");
  end
endmodule

Piet

Piet

Notes and Final Thoughts

  • There are a lot of programming languages in this world
  • LOLCODE should be more well known and people should use it more often
  • Never write in whitespace ever again
This post is licensed under CC BY 4.0 by the author.