Skip to content

seanpm2001/Learn-LOLCODE


/LOLCode_logo.png

Learning LOLCODE (programming language)

I know very little about the LOLCODE programming language. This document will go over all of my knowledge of the LOLCODE programming language.

Hello World in LOLCODE

This is how you make a Hello World program in LOLCODE:

HAI 1.2
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE

Comments in LOLCODE

Comments in LOLCODE are unique, no other language currently uses comments like LOLCODE does.

Single line comments

Single line comments in LOLCODE are written like so:

BTW This is a comment

The BTW keyword is similar to the REM keyword in Batchfile. They both are for comments.

Multi-line comments

Multi-line comments in LOLCODE are written like so:

OBTW
This is a multi-line
comment in LOLCODE
TLDR

Multi-line comments start with OBTW and end with TLDR

Break keyword in LOLCODE

break;

To this day, I am still not entirely sure what the break keyword does, but most languages support it.

I am not sure if LOLCODE supports the break keyword

/!\ This example has not been tested yet, and may not work

Shebangs in LOLCODE

LOLCODE has version specific Shebang lines. Currently, I only know of 3 that exist.

Misc

A miscellaneous LOLCode shebang.

HAI
BTW This is a LOLCODE program
KTHXBYE
V1.0

A version 1.0 LOLCODE Shebang.

HAI 1.0
BTW This is a LOLCODE 1.0 program
KTHXBYE
V1.2

A version 1.2 LOLCODE Shebang.

HAI 1.2
BTW This is a LOLCODE 1.0 program
KTHXBYE

End keyword

The end keyword is written as KTHXBYE it is to go at the end of a loop, or at the end of a program.

HAI
BTW I am going to go now
KTHXBYE

Error handling

LOLCODE supports error handling with the O NOES keyword. Error handling can be done like so:

HAI 1.0
CAN HAS STDIO?
PLZ OPEN FILE "/dev/null/"
    AWSUM THX
        VISIBLE FILE
    O NOES
        INVISIBLE "ERROR!"
KTHXBYE

Standard IO

LOLCODE supports standard input/output through the following keyword:

CAN HAS STDIO?

Opening files

LOLCODE supports file I/O. To open a file, simply run this:

LOLCATS.txt
PLZ OPEN FILE "LOLCATS.TXT"?
    AWSUM THX
        VISIBLE FILE
    O NOES
        INVISIBLE "ERROR!"

Defining a variable

Defining variables in LOLCODE can be done like so:

I HAS A VAR

Defining a loop

LOLCODE 1.0

Defining a loop in LOLCODE 1.0

HAI 1.0
IM IN YR LOOP
    UP VAR!!1
    VISIBLE VAR
    IZ VAR BIGGER THAN 10? KTHX
IM OUTTA YR LOOP
KTHXBYE
LOLCODE 1.2

Defining a loop in LOLCODE 1.2

HAI 1.2
CAN HAS STDIO?
IM IN YR LOOP UPPIN YR VAR TIL BOTH SAEM VAR AN 10
    VISIBLE SUM OF VAR AN 1
IM OUTTA YR LOOP
KTHXBYE

Other knowledge of the LOLCODE programming language

  1. LOLCODE is a language by [Unknown]

  2. LOLCODE is not a semicolon and curly bracket language

  3. LOLCODE uses the *.lol and *.lols file extensions

  4. LOLCODE is an esotoric programming language

  5. Currently, as of 2022 Wednesday July 27th, 1 variant of LOLCODE is turing complete

  6. LOLCODE is influenced by the Lolcat series of Internet memes

  7. LOLCODE is not one of the top 50 programming languages (as of 2022)

  8. LOLCode is one of the top 50 esotoric programming languages (as of 2022)

  9. No other knowledge of the LOLCODE programming language

Additional comments

  1. LOLCODE is a fun language to write in. I would love to use it for serious purposes, but my usage will remain limited. Unfortunately, I cannot has supercomputer lolz.

File info

File type: Markdown document (*.md *.mkd *.mdown *.markdown)

File version: 1 (2022, Wednesday, July 27th at 7:33 pm PST)

Line count (including blank lines and compiler line): 276


File history

Click/tap here to expand/collapse the history for this file

Version 1 (2022, Wednesday, July 27th at 7:33 pm PST)

Changes:

  • Started the file
  • Added the title section
  • Added the Hello World in LOLCODE section
  • Added the Comments in LOLCODE section
  • Added the Single line comments subsection
  • Added the Multi-line comments subsection
  • Added the break keyword in LOLCODE section
  • Added the Shebangs in LOLCODE section
  • Added the Misc subsection
  • Added the V1.0 subsection
  • Added the V1.2 subsection
  • Added the End keyword section
  • Added the Error handling section
  • Added the Standard I/O section
  • Added the opening files section
  • Added the Defining a variable section
  • Added the Defining a loop section
  • Added the LOLCODE 1.0 subsection
  • Added the LOLCODE 1.2 subsection
  • Added the other knowledge of the LOLCODE programming language section
  • Added the Additional comments section
  • Added the file info section
  • Added the file history section
  • No other changes in version 1