Learn to Code via Tutorials on Repl.it!

← Back to all posts
Viper2211 (86)


LOLCODE is an esolang (short for esoteric language) made by Adam Lindsay. According to Google, esoteric means "intended for or likely to be understood by only a small number of people with a specialized knowledge or interest." You'll see how that definition is true as we continue.

Before you start

All LOLCODE programs must start with HAI 1.2 and end with KTHXBYE. This is very important to remember!

Hello World! (Displaying things with LOLCODE)

As usual, we'll be starting with the simplest command.

Here's the code:

The VISIBLE function displays text or variables.
In this case, it is displaying the string "HELLO WORLD" which is defined by the quotes surrounding it.


One line comments in LOLCODE use the BTW keyword.
An example is below:

Multiline comments begin with OBTW and end with TLDR.
An example is below:

Declaring variables

In LOLCODE, variables are declared like so:

Here is an example:

In the example, we declare a variable with the name VARIABLE witha a value of 2. You do not have to specify the data type, and the value of the variable does not need to be assigned right now. It can also be down like so:

Next, we have LOLCODE's different data types.

Data types

LOLCODE has 5 different data types.

Now, let's take a closer look at each of them.


A NUMBR is the LOLCODE version of an integer. It is a number with no floating points (decimals)


A NUMBAR is a float. It is an integer with a decimal point and numbers beyond it


A YARN is a string. It is a string of characters and numbers!


A TROOF is a boolean. It can be either WIN or FAIL, with WIN meaning True and FAIL meaining False


A NOOB is the null type or undefined type. It has a value of no value. Make sense?


The math in lolcode is written somewhat like Polish Notation. Here are all the different operators!

Here is a general syntax rule for math :

You can even do nested math like so:

But this is where it gets confusing. Doing nested math can make code messy and I would recommend just doing it line by line.


Comparisons in if statements are important to know. Here is are all the different comparisons.

For a general syntax rule that applies to all of them :

The condition can change.
Just like LOLCODE's math operators are different, its booleans are also different. To thoroughly explain them, lets take a closer look below.

Equal to (==)

The BOTH SAEM keyword is the LOLCODE version of ==. The syntax is below

If x is equivalent as y, then the statement will return WIN (which is the same as True) and the code below will be executed. Otherwise, it will return FAIL

Not Equal To

Not equal to is just like the equal to part, but just with different keywords.

If x is not the same as as y the code below will be executed.

Greater Than or Equal To and Less Than Or Equal To

Greater than or equal to:

Less than or equal to:

Greater Than and Less Than

Greater than :

Less than:

User Input

Now that we're FINALLY done with booleans, lets make our program interactive. It's done with GIMMEH keyword. The syntax is below:

On input, the value of the var will be of the data type YARN (string). So we are going to have to convert the data type of the variable.

If statements

If statements have the general syntax :

The first condition and the other condition in the example above are comparisons (like BOTH SAEM and DIFFRINT)
But what is the OIC? Well, the OIC is just there to tell LOLCODE that that is where the If statement ends.

That's all for now. Later!