LOLCODE

LOLCODE is a general-purpose programming language being developed to resemble the kitty pidgin natlang of the lolcat phenomenon. It was initially created in 2007, one year after LOLCATS became an Internet meme and development continued for some time before the creator lost interest (or something like that).

Keywords
These are the main keywords. All LOLCODE keywords are written in uppercase.

Functions
Functions can be declared with

A function can return with one of the following statements:
 * FOUND YR [expression] returns the value of the expression
 * GTFO return without value (NOOB)

A function can be called with I IZ [function name] (YR [argument1] (AN YR [argument2] (AN YR [argument3] ...))) MKAY. If the arguments are expressions, they are evaluated before the function is called.

Types
There are currently 6 types available: YARN (string), NUMBR (integer), NUMBAR (float), TROOF (boolean), BUKKIT (array) and NOOB.

NOOB
This is the untyped type. All declared variables without a value are of this type and their value is also NOOB. This type can implicitly only be cast to TROOF and returns FAIL. If explicitly cast to other types it will return the default value for the new type.

TROOF
This is the equivalent of a boolean variable. It can have one of two values: WIN (true) and FAIL (false). When types are cast to TROOF, an empty string (""), an empty array and numerical zero return FAIL. All other values are cast to WIN.

Numerical types
A NUMBR is an integer as specified in the host implementation/architecture. Any contiguous sequence of digits outside of a quoted YARN and not containing a decimal point (.) is considered a NUMBR. A NUMBR may have a leading hyphen (-) to signify a negative number.

A NUMBAR is a float as specified in the host implementation/architecture. It is represented as a contiguous string of digits containing exactly one decimal point. Casting a NUMBAR to a NUMBR truncates the decimal portion of the floating point number. Casting a NUMBAR to a YARN (by printing it, for example), truncates the output to a default of two decimal places. A NUMBAR may have a leading hyphen (-) to signify a negative number.

Casting of a string to a numerical type parses the string as if it were not in quotes. If there are any non-numerical, non-hyphen, non-period characters, then it results in an error. Casting WIN to a numerical type results in "1" or "1.0"; casting FAIL results in a numerical zero.

YARN
YARNs are demarked with double quotation marks ("). A YARN without a closing quote will cause an error. All characters inside a string represent their own value except the colon, which is being used as the escape character. The following escape sequences are available:
 * :) is a newline (\n)
 * :> is a tab (\t)
 * :O is a beep (\g)
 * :" is a literal double quote (")
 * :: is a literal colon
 * :([hex]) resolves the hex number into the corresponding Unicode code point.
 * :{[var]} interpolates the current value of the enclosed variable, cast as a string.
 * :[[char name]] resolves the [char name]  in capital letters to the corresponding Unicode normative name.

BUKKIT
This type represents an array. It has named slots, which can contain either variables or functions. A BUKKIT can be declared in one of two ways: BTW declaration of the BUKKIT I HAS A [object] ITZ A BUKKIT

BTW creating a variable in a slots [object] HAS A [var] ITZ [value]

BTW creating a function inside the BUKKIT HOW IZ [object] [function name] (YR [argument1] (AN YR [argument2] (AN YR [argument3] ...))) [function code] IF U SAY SO The other way is: BTW declaration of the BUKKIT O HAI IM [object] BTW creating a variable in a slot I HAS A [var] ITZ [value]

BTW creating a function inside the BUKKIT HOW IZ I [function name] (YR [argument1] (AN YR [argument2] (AN YR [argument3] ...))) [function code] IF U SAY SO KTHX

A variable inside a BUKKIT can be used with [object]'Z [var]. A function inside a BUKKIT can be called with  [object] IZ [function] (YR [argument1] (AN YR [argument2] (AN YR [argument3] ...))) MKAY  or with  I IZ [object]'Z [function] (YR [argument1] (AN YR [argument2] (AN YR [argument3] ...))) MKAY </tt>

A function inside a BUKKIT may also access variables and other functions of the BUKKIT by using ME'Z [var]</tt> or ME IZ [function name] (YR [argument1] (AN YR [argument2] (AN YR [argument3] ...))) MKAY</tt>

Hello World
This program prints "Hai world!" to the standard output. HAI 1.3 VISIBLE "Hai world!" KTHXBYE

Loops
This program counts from 0 to 9 and prints the numbers on a single line to the standard output. HAI 1.3 IM IN YR loop UPPIN YR var TIL BOTH SAEM var AN 10 VISIBLE SMOOSH var AN " " MKAY! IM OUTTA YR loop KTHXBYE

Stack
This program implements a stack-like structure in LOLcode and demonstrates its use. HAI 1.3 O HAI IM pile I HAS A length ITZ 0 I HAS A max ITZ -1 HOW IZ I pushin YR item DIFFRINT ME'Z max AN BIGGR OF ME'Z max AN ME'Z length, O RLY? YA RLY, ME HAS A SRS ME'Z length ITZ item, ME'Z max R SUM OF ME'Z max AN 1 NO WAI, ME'Z SRS ME'Z length R item OIC ME'Z length R SUM OF ME'Z length AN 1 IF U SAY SO	HOW IZ I popin DIFFRINT ME'Z length AN 0, O RLY? YA RLY ME'Z length R DIFF OF ME'Z length AN 1 I HAS A item ITZ ME'Z SRS ME'Z length ME'Z SRS ME'Z length R NOOB FOUND YR item OIC IF U SAY SO	HOW IZ I gettinLen FOUND YR ME'Z length IF U SAY SO KTHX

I HAS A stack ITZ LIEK A pile

stack IZ pushin YR "testvalue" MKAY stack IZ pushin YR "value2" MKAY VISIBLE stack IZ popin MKAY stack IZ pushin YR "lolcat" MKAY stack IZ pushin YR "longcat" MKAY VISIBLE stack IZ popin MKAY VISIBLE stack IZ popin MKAY VISIBLE stack IZ popin MKAY

KTHXBYE Output: value2 longcat lolcat testvalue

Criticism
LOLCODE is often criticized for not being Esoteric enough. By design, LOLCODE is actually a normal procedural language behind its lulzy syntax. This is a stark contrast from "True" Esolangs like Befunge, which features a two-dimensional, almost game board-like syntax. For this reason, LOLCODE is technically categorized as a Weirdlang.

An example of how LOLCODE is just a normal language with weird syntax is shown here. This is an identical program to the above "Stack" program, but with nothing changed except the syntax: BEGIN program VERSION 1.3 CLASS stack{ ATTR VAR length = 0 ATTR VAR max = -1 FUNCTION push item{ IF THIS.max != (bigger(THIS.max, THIS.length){			THIS[THIS.length] = item			THIS.max+1		} ELSE {			THIS[THIS.length] = item			}		THIS.length+=1	}

FUNCTION pop{ IF THIS.length != 0{ length-=1 item = THIS[THIS.length] THIS[THIS.length] = null RETURN item }	}	FUNCTION getLen{ RETURN THIS.length } }

stack s = new stack

s.push("testvalue") s.push("value2") PRINT stack.pop s.push("normal human being") s.push("Basketball player") PRINT s.pop PRINT s.pop PRINT s.pop

END program

Output: value2 Basketball player normal human being testvalue

External resources

 * Main site
 * LOLcode interpreter
 * Brainfuck interpreter written in LOLcode
 * 99 bottles of beer. On August 3, 2007 LOLCODE was the top rated entry on the 99 bottles of beer site.
 * Extensive article on Wikipedia.