Hello, World!

This seemed like an appropriate first post for a blog about scripting and programming (and Unix in general) since that is the first program anyone learns to write in a computer language.

If I told you the frustrating, tedious story behind how this post’s tags caused an enormous issue that broke the site and took hours to fix, you would appreciate why I chose the insane sysadmin as my mascot! Suffice to say, I’m glad it’s working finally.

I think we’ve all found ourselves chasing down weird bugs that make us want to rip our hair out and pound on the keyboard in frustration. That’s kind of why I created this page. I want to offer hard won and battle tested advice, tools that are actually friendly and robust and hopefully bring a smile to the frazzled sysadmin who loves this stuff anyway!

Hello, World in Different Languages

Here is Hello World in every language I have dabbled in for one reason or another. These days I tend to stick with Bash, Python and the occasional compiled language.

BASIC

This was the language of my first computer, the Commodore 64!

10 PRINT "HELLO, WORLD"
20 END

Turbo Pascal

This was the first language I learned in school. Limited but kind of lovely.

program HelloWorld;
begin
  Writeln('Hello, World');
end.

For some reason Chroma refuses to format my pascal block correctly no matter what I do. So I’ve decided to accept it as an example of Wabi-sabi and move on with my life. I once wrote a Cthulhu themed text adventure in Pascal that hit all the limits for file size, number of files and memory. Fun times!

Programming Your Own Adventure Games in Pascal book cover
Programming Your Own Adventure Games in Pascal
a fantastic vintage guide, now freely readable on the Internet Archive.

Bash

The Swiss Army knife of Unix. A one-liner here can topple servers or automate your life!

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

Perl

The duct tape of the early web—messy and often unreadable. Perl was my first real scripting language

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

Python

Where Perl is inscrutable, Python is elegant — I honestly thought it was pseudocode the first time I saw it. These days, it’s my primary language.

#!/usr/bin/env python3
print("Hello, World")

C

I mean Unix is written in C. Garbage collection, recursion and double linked-lists ahoy!

The C Programming Language by Kernighan & Ritchie
Kernighan & Ritchie — This book is effortlessly brilliant. Like Euclid's Elements for programming.
#include <stdio.h>

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

C++

The language behind just about everything for a long time.

C++ How to Program by H.M. Deitel and P.J. Deitel
C++ How to Program by H.M. Deitel & P.J. Deitel — a brilliant, and unforgettable classic of the '90s programming bookshelf.
#include <iostream>
using namespace std;

int main() {
    cout << "Hello, World" << endl;
    return 0;
}

Java

Java powers everything from Minecraft and Spotify to Apache Hadoop to the NASDAQ to your home appliances. Not always fun to progam in but incredibly powerful and worth learning.

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

Ruby

I always joked that Ruby was a language for art majors. Elegantly difficult to follow.

#!/usr/bin/env ruby
puts "Hello, World"

PHP

The language that built half the internet. This was the language for cgi for a very long time. I never loved it but I always respected it.

<?php
echo "Hello, World\n";
?>

Objective-C

The language of NeXTSTEP and Apple!

#import <Foundation/Foundation.h>

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

Lisp

Such a cool language! A ton of seminal AI research was done using Lisp.

(format t "Hello, World~%")
The Little LISPer book cover
The Little LISPer — this short book will rewire your brain and change how you think about recursion.

Lua

If you ever tried modding a game, you might have run into the Lua scripting language. Perfect for powering little video game monster’s brains.

print("Hello, World")

JavaScript (Node.js)

The modern web wouldn’t exist without it. I never really liked pure Javascript but Node.js is amazing.

console.log("Hello, World");

x86 Assembly (NASM, Linux)

Programming in assembly is like programming with DNA. It takes a lot of writing to do anything because it is as close to the hardware as you want to get.

section .data
    msg db "Hello, World", 0xA   ; The string, with newline
    len equ $ - msg

section .text
    global _start

_start:
    mov eax, 4        ; sys_write
    mov ebx, 1        ; file descriptor (stdout)
    mov ecx, msg      ; message address
    mov edx, len      ; message length
    int 0x80          ; call kernel

    mov eax, 1        ; sys_exit
    xor ebx, ebx      ; exit code 0
    int 0x80

Ada

Named after Lady Lovelace, this general-purpose, strongly typed, systems language has been used in avionics, missile guidance systems, satellites, rail control systems, even traffic lights.

with Ada.Text_IO; use Ada.Text_IO;

procedure Hello_World is
begin
   Put_Line ("Hello, World");
end Hello_World;

Smalltalk

This was a really neat language!

Transcript show: 'Hello, World'; cr.

COBOL

THE HORROR…

Rear Admiral Grace Hopper
Rear Admiral Grace Hopper—pioneer of programming languages, inventor of the first compiler, and one of the driving forces behind COBOL.
She coined the term “debugging” and could out-logic any mainframe (in heels no less).
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
PROCEDURE DIVISION.
    DISPLAY "HELLO, WORLD".
    STOP RUN.

Fortran

It’s shocking how much Fortran code is still out there.

PROGRAM HELLO
PRINT *, 'Hello, World'
END

Intentionally Obtuse Code

Here’s a fun recursive example!

def painfully_hello(msg, i=0):
    if i < len(msg):
        print(msg[i], end='', flush=True)
        painfully_hello(msg, i + 1)

painfully_hello("Hello, World")

And another in Lisp

(defun painfully-hello (letters)
  (when letters
    (princ (car letters))
    (painfully-hello (cdr letters))))

(painfully-hello (list #\H #\e #\l #\l #\o #\, #\Space #\W #\o #\r #\l #\d))

Welcome

Just to make sure you feel extra welcome, and please forgive me if I left off your favorite language:

  • English: Welcome!
  • French: Bienvenue !
  • German: Willkommen!
  • Italian: Benvenuto!
  • Spanish: ¡Bienvenido!
  • Portuguese: Bem-vindo!
  • Polish: Witaj!
  • Ukrainian: Ласкаво просимо! (Laskavo prosymo!)
  • Turkish: Hoş geldiniz!
  • Yoruba: Ẹ ku abọ!
  • Hindi: स्वागत है! (Swāgat hai!)
  • Sanskrit: स्वागतं! (Svāgataṁ!)
  • Latin: Salve!
  • Greek: Καλώς ήρθατε! (Kalós írthate!)
  • Japanese: ようこそ! (Yōkoso!)
  • Mandarin: 欢迎! (Huānyíng!)
  • Arabic: أهلاً وسهلاً! (Ahlan wa sahlan!)
  • Klingon: yI’el! (literally “Enter!”)
  • Quenya: Hantale! (formal welcome/gratitude)
  • Esperanto: Bonvenon!

Conclusion

There you have it! That’s hello world and welcome in 20 languages. I hope you enjoy the site!


Want to connect?

feedback@adminjitsu.com
GitHub: forfaxx


See you in the trenches.