Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Welcome to XCODX Online Compiler
Quick Start:
Ctrl+Enter Run code
Ctrl+S Save / Download
Ctrl+L Clear output
Select a language and start coding.
Born from the lolcat meme at its 2007 peak, LOLCODE was specified by Adam Lindsay at Lancaster University as a language whose keywords are internet-cat grammar: programs open with HAI, close with KTHXBYE, and print with VISIBLE. Beneath the jokes sits a workable imperative language with variables via I HAS A, conditionals through O RLY?, loops in IM IN YR blocks, and typed values it calls NOOBs, NUMBRs, and YARNs. It became one of the most recognizable joke languages ever, a staple of esolang lists and novelty golf answers alike. XCODX runs a LOLCODE interpreter in a real interactive terminal, so GIMMEH genuinely waits for the line you type, with nothing to install first.
HAI 1.2
BTW VISIBLE prints a line to the terminal
VISIBLE "HAI, WORLD!"
KTHXBYE
LOLCODE is a gateway drug for esolang exploration and a reliable laugh in teaching settings: because the semantics underneath are ordinary, students can write real loops and conditionals while the meme syntax keeps the room engaged. It appears in novelty and popularity-contest challenges on Code Golf Stack Exchange, and implementing a LOLCODE interpreter is a popular weekend project since the 1.2 specification is short, complete, and freely available.
Yes, within limits. The 1.2 specification defines variables, arithmetic, string concatenation with SMOOSH, conditionals, switch-style WTF? blocks, loops, and functions declared with HOW IZ I. Multiple interpreters implement it faithfully. It is Turing complete and perfectly capable of FizzBuzz or text processing; what it lacks is libraries and any reason beyond joy to use it in production.
The GIMMEH statement reads a line from stdin into a variable as a YARN, LOLCODE's string type, which you can recast to a NUMBR with MAEK or implicit typecasting for arithmetic. In the XCODX terminal GIMMEH blocks until you press enter, so interactive prompt-and-respond programs behave exactly as the specification intends.
They are the mandatory program delimiters in the specification, standing in for the greeting and sign-off of lolspeak conversation. HAI traditionally carries a version number such as 1.2 so interpreters know which specification revision to apply. Omitting either is a syntax error in strict interpreters, which is itself part of the joke: meme grammar, rigidly enforced.
I HAS A introduces a variable, as in I HAS A score, optionally initialized with ITZ, like I HAS A score ITZ 5. Afterward you assign with R, as in score R 10. Variables are dynamically typed and can hold a NOOB, TROOF, NUMBR, NUMBAR, or YARN, and you can retype a variable simply by assigning a value of a different kind.
Operators are named and written in prefix form: SUM OF, DIFF OF, PRODUKT OF, QUOSHUNT OF, and MOD OF, each joining two operands with AN. So SUM OF 2 AN 3 is five, and you nest them, like PRODUKT OF 2 AN SUM OF 3 AN 4. Spelling operators out as cat-speak words is central to the joke, and it sidesteps precedence entirely.
LOLCODE branches on the implicit variable IT, which holds the result of the last expression. You evaluate something, then open O RLY?, put the true branch after YA RLY, optional else-ifs under MEBBE, the false branch after NO WAI, and close with OIC. It reads like a bewildered cat weighing its options, but underneath it's an ordinary if-else.
main.lolplain text — no highlighter ships for this languageGIMMEHHAI 1.2
CAN HAS STDIO?
VISIBLE "Hello from LOLCODE!"
KTHXBYE