13 different ways to print “hello world” in 13 different programming languages.

So, It’s: Python vs JavaScript vs Bash vs C vs C# vs C++ vs Assembly vs Java vs Perl vs Go vs HTML vs PHP vs Swift.

Some people say that learning to “Hello world” is half the language, so

Let’s start the fight.

Python – the easiest.

It’s simple.

print("Hello world")

Javascript – the semicolon paradox.

Always HATED the semicolon…

alert("Hello World");

Bash – shell out.

The heart of the shell. I prefer zsh though.

#!/bin/bash
echo "Hello World!";

C – can you ‘see

The one that rules them all (after assembly, of course…)

#include<stdio.h>
int main(void) {
    printf("Hello World\n");
    return 0;
}

C# – too sharp

The C version of Java (and, I don’t like Java that much…)

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

C++ – C improved (I suppose)

Did you get the vim joke?

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

Assembly – the “real” king

We must assemble to be able to learn this.

section	.text
   global_start   ;must be declared for linker (ld)
	
_start:	          ;tells linker entry point
   mov	edx,len   ;message length
   mov	ecx,msg   ;message to write
   mov	ebx,1     ;file descriptor (stdout)
   mov	eax,4     ;system call number (sys_write)
   int	0x80      ;call kernel
	
   mov	eax,1     ;system call number (sys_exit)
   int	0x80      ;call kernel
section	.data
msg db 'Hello, world!', 0xa  ;string to be printed
len equ $ - msg     ;length of the string

I can’t even find syntax highlighting


Java – the coffee cup

I always wanted to taste that coffee.

public class java {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}

Perl – just ‘perl’

The perl of the shell.

#!/usr/bin/perl
print "Hello World\n";

Go – let’s go

There’s an animal in the logo.

package main
import "fmt"
func main() {
    fmt.Println("Hello world")
}

No syntax highlighting here TOO, weird


HTML – they say it’s a markup language.

Not a real programming language.

<!DOCTYPE html>
<html>
 <head>
  <title>Hello world</title>
 </head>
 <body>
  <h1>Hello world</h1>
 </body>
</html>

PHP – HTML organizer.

The most used web language yet.

<?php
    print("Hello World");
?>

Swift – apple special

Exactly like Python, but too expensive.

print("Hello world")

And as someone once said

Good Bye everyone

and it was me…

~ViloDium

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s