Hello World in LOLCODE: A Very Peculiar Programming Language

  • January 11, 2020

  • 3 min read

HAI 1.2
    VISIBLE "Hello, World!"

Yes, that was a "Hello, World!" program in the famous LOLCODE programming language.

LOLCODE is an esoteric programming language, a type of programming language which is defined by the Esolang Wiki as follows:

An esoteric programming language is a computer programming language designed to experiment with weird ideas, to be hard to program in, or as a joke, rather than for practical use.

Other esoteric programming languages include the famous Brainf*** programming language, Malbolge, and more.

LOLCODE was written to be programming language to mimic the "lolcats" meme which became popular in the mid-2000s, with basic syntax including words such as HAI (start program with version number) and KTHXBYE (end program).

Like many other esoteric programming languages, LOLCODE is actually very featured, and has the capability to be used to write many complex programs.

In fact, Justin Meza, the creator of the most recent LOLCODE interpreter, created httpd.lol, an HTTP server written entirely in LOLCODE.

Let's Write a Basic LOLCODE Program

First, to run actual LOLCODE programs, I'll be using the LOLCODE Repl.it Online Interpreter, although you can download the LOLCODE C Interpreter to run LOLCODE programs locally.

HAI and KTHXBYE for starting and ending programs

Every LOLCODE program starts with a HAI declaration, followed by a version number. For example:

HAI 1.2

With the HAI declaration, the end of every program must include a KTHXBYE statement, for example:

HAI 1.2


BTW and OBTW for comments

The BTW keyword introduces a single line comment, like this:

BTW this is a single line comment

Whereas the OBTW and TLDR keywords are used to start and end a multiline comment respectively, for example:

This is a multiline comment

VISIBLE for printing to stdout

To print text in LOLCODE, the VISIBLE keyword is used as follows:

VISIBLE "Hello, World!"

Variables with I HAS A [varname] ITZ [value]

Variables in LOLCODE are written with the syntax I HAS A [var] ITZ [value], for example:

BTW this sets the variable NAME to the value "Gabriel Romualdo"
I HAS A NAME ITZ "Gabriel Romualdo"

Variables can then be referenced later with the same name.

SMOOSH and AN for concatenation

To concatenate strings and variables, SMOOSH is used. Example is provided in basic program below.

A Basic Program to Concatenate Strings and Variables

Now, we'll combine these basic LOLCODE keywords and syntax to create a very, very basic program which concatenates strings and variables.

The Python equivalent of this would be:

name = "Gabriel Romualdo"
website = "xtrp.io"
favorite_color = "blue"

print("Hi, I am " + name + ", my website is at " + website + " and my favorite color is " + favorite_color + ".")

Which in LOLCODE is:

HAI 1.2
        This program creates several variables, concatenates them, and prints them.

    BTW create variables
    I HAS A NAME ITZ "Gabriel Romualdo"
    I HAS A WEBSITE ITZ "xtrp.io"

    BTW concatenate with SMOOSH and AN
    VISIBLE SMOOSH "Hi, I am " AN NAME AN ", my website is at " AN WEBSITE AN " and my favorite color is " AN FAVORITECOLOR AN "."

And produces the following output successfully:

Hi, I am Gabriel Romualdo, my website is at xtrp.io and my favorite color is blue.

Note that some interpreters may require LOLCODE programs to include the STDIO library, which can be included with a CAN HAS [library]? statement.


I hope you enjoyed this post and found LOLCODE to be a funny yet interesting programming language. You can read more about LOLCODE and its syntax on the LOLCODE Esolang Wiki Page, and check out The LOLCODE Website.

Thanks for scrolling.

— Gabriel Romualdo, January 11, 2020