LOLCODE MADE EZZZZZ 🙀 😻 😹
Y HALO THAR EVRYONE!!!
HOPE EVRYONEZ DOIN NICE AN CHILLIN!
WELCOM 2 LOLCODE TUTORIAL!!!
I SET ON TEH PATH 2 LERN LOLCODE. WELL. IT WUZ CERTAINLY REWARDIN EXPERIENCE LULZ.
AS U CAN C, IM SPEAKIN IN ALL CAPS IN DA SACRD LANGUAGE OV TEH LOLCATS! IF U DOAN UNDERSTAND, CHECK DIS TRANZLATOR OUT HER. SAY THE STUFF U DONT COMPREHEND OUT LOUD TO UNDERSTANDZ WAHT THIS MEANZ!
DIS AR TEH GONNA BE VRY ANNOYIN, BUT IZ 2 GIT U USD 2 LOLCODEZ SYNTAX!
OKIE DOKIE LETS START!
ILL BE COVERIN:
- WUT LOLCODE IZ
- STARTING A PROGRAM
- DATA TYPEZ
- FOR LOOPZ
- WHILE LOOPZ
- SMALL PROGRAMS
- HELPFUL LINKZ
- BAI BAI
WUT LOLCODE IZ
LOLCODE IZ ESOTORIC PROGRAMMIN LANGAUGE. ESOTORIC MEANZ "intended for or likely to be understood by only a small number of people with a specialized knowledge or interest." (HERE). IT WUZ INSPIRD BY TEH FUNNY LANGAUGE SPOKEN BY LOLCATS (HENCE Y IM SPEAKIN LIEK DIS. FRANKLY, QUITE ANNOYIN, BUT OH WELL). LOLCODE WUZ CREATD IN 2007 BY ADAM LINDSAY, DIS DOOD (I FINKZ, NOT MUTCH IMAGEZ ON TEH INTERNET :/):
AN TEH ICON OV LOLCODE IZ DIS:
BTW DIZ IS A LOLCAT:
Ok now I stop using that annoying language, or else y'all won't understand anything and that'll be sad.
An important thing about LOLCODE is that everything is written in ALL CAPS. Indentation is irrelevant (yay). ALso, it would be great if you already know some languages, it would make learning this language much easier. I totally recommend learning Python first via this amazing tutorial here, or C++ with this super tutorial here! ;) Finally, no syntax highlighting for LOLCODE, so yea much sad.
Oh and also, this tutorial won't only help you learn LOLCODE, it'll also reinforce your programming knowledge and also teach very useful internet slang.
STARTING A PROGRAM
First of all, to begin a program, we need to start it off with
1.2 is basically the version of LOLCODE, and
HAI is just saying "Hi". Then, every program must end with
KTHXBYE, which means "Ok, thanks, bye".
And in between those two lines, we'll have the program.
For outputting to the console (the black part), we use the statement
VISIBLE. Here's your first "Hello World!" program in LOLCODE!
Comments are very useful in programming as they can make it easier for others to read your code. They can also be used to organize your code and leave notes for yourself. Comments are completly ignored by the compiler, meaning that everything behind or in a comment will not be executed (run) by the program.
In LOLCODE, comments are written with
BTWstands for "By the way".
We can also have comments on several lines using
OBTWstands for "Oh, by the way".
TLDRstands for "Too long didn't read".
In LOLCODE, there are 5 main types:
- Strings (A sequence of characters. Eg:
- Integers (A number. Eg:
- Floats (Composed of strings and numbers. Eg:
- Booleans (Binary types, either True or False. Eg:
- Arrays (A collection of items. Eg:
[1, 3, 5, 7])
But in LOLCODE, they have different names:
- Strings =
YARN(because yarn is composed of strings lol)
- Integers =
- Floats =
- Booleans =
WINand False =
- Arrays =
In LOLCODE, there are also these smiley faces, kinda like
ANSI escape codes:
Since colons (
:) are used as escape characters in LOLCODE, and any value following a colon makes a specific action:
:) --> A colon with a closing parenthesis -->
:> --> A colon with a closing angle bracket -->
:o --> A colon with a 'o' -->
:" −-> A colon with a double quote --> literal double quote
:: −-> A colon with another colon --> literal colon
As you can see, you can use several of those "smileys" in succession, and you can mix and match them up. The
:: is for just one colon
:, and the
:" is for one double quote
"; if you just put one colon, or just one double quote, or if you omit the colon before like so:
This will happen:
Because a single colon
: isn't a valid keyword, you need two of them:
Or in the second case:
This will happen:
As it will think
disgusting is a variable, so you need a colon before the double quote:
Think of variables like boxes that can change values and vary, hence the name. To declare a variable, you use
I HAS A [variable]. Also, when I put
[variable], you don't have to put that name, and the square braquets are not needed (it was just to represent where to put the variable).
I HAS Ameans "I have a"
Now that's just declaring the variable. Also, the data type of the variable is handled automatically by LOLCODE. If the variable does not have an initial value, it's declared as untyped, which is
NOOB in LOLCODE.
But you can specify yourself what data type a variable is, using
I HAS A [variable] ITZ A [data type]. But this unforunately doesn't work as well in repl.it, so I tried it in an online LOLCODE IDE and it works.
If you're curious, on repl.it it gives this error:
So as it works perfectly on that IDE, this is probably a problem with repl.it =/
Here is an example of declaring a variable and their data type:
A few tips for naming variables (they apply for all programming languages):
Variables are used to hold things, so you should try to name your variables accordingly. For example, you won't name a variable holding an age "bananas" or a variable holding a name "thingy".
Also, try to use camelCase in variables: if you have several words in the variables, join them together and capitalize the 1st letters (except the 1st word). Like the tip above, this is not needed, but just makes your code more readable, and easier for someone to look at your code.
Don't start a variable name with a number.
No spaces or special characters.
No using keywords (eg:
HAI) as the names.
If you try to follow those tips, not only will your code run smoothly and without errors, but it will look good and you will be able to read the code faster.
Now to actually assign a value to the variable, we do
I HAS A [variable] ITZ [value].
ITZmeans "It is".
Once a variable is declared with a data type, you can change it to a different data type, that is called casting.
Casting is when you convert a variable's data type to another data type, for example when you cast a
NUMBR) to a
FLOAT). You can cast variables with
MAEK [variable] A [data type] (which means "MAKE ... A ..."). This doesn't seem to work on repl.it so I did it on another LOLCODE IDE.
To output variables, we just do
To give variables a new value, we use
Let's change the variable
Concatenation means joining two things together. For example, the concatenation of "snow" and "ball" makes "snowball".
We can concatenate easily in LOLCODE by using
MKAY, and seperating the different arguments with
SMOOSHmeans "to press together",
MKAYmeans "Hum ok", and
An example of concatenation using the variables from above:
As you can see, we joined together the strings
"My name is " and
" I am " and
" years old", as well as the variables
VISIBLE, we wrote
SMOOSH, seperated of all those with
AN, and added
MKAY at the end.
Input is used to collect stuff from the user. In LOLCODE, we use
GIMMEH as the keyword for input.
GIMMEHmeans "Give me".
Let's make a program that asks the user for their favourite color, store it in a variable (so we can use it later), then output what the user said using concatenation:
Operators are basically symbols that can be used in math. Here is the list of operators:
+For adding numbers
-For subtracting numbers
*For multiplying numbers
/For dividing numbers
%Modulo (for dividing numbers and returning what's left)
But in LOLCODE, they have different names:
SUM OF [number1] AN [number2]
DIFF OF [number1] AN [number2]
PRODUKT OF [number1] AN [number2]
QUOSHUNT OF [number1] AN [number2]
MOD OF [number1] AN [number2]
BIGGR OF [number1] AN [number2]
SMALLR OF [number1] AN [number2]
And replace the variables
[number2] with the variables/numbers of your choice (without the square braquets of course lol).
Comparisons are used to, well, compare things.
Here is the list of comparisons:
>=Bigger or equal to
<=Smaller or equal to
And of course, in LOLCODE they have different names:
BOTH SAEM [variable1] AN [variable2]
BOTH DIFFRINT [variable1] AN [variable2]
BOTH SAEM [variable1] AN BIGGR OF [variable1] AN [variable2]
BOTH SAEM [variable1] AN SMALLR OF [variable1] AN [variable2]
DIFFRENT [variable1] AN BIGGR OF [variable1] AN [variable2]
DIFFRENT [variable1] AN SMALLR OF [variable1] AN [variable 2]
And replace the variables
[variable2] with the variables/numbers of your choice (without the square braquets of course lol).
20 are not the same, then
20 are different, then
15 >= 20 isn't correct, then
We will use these comparisons later in conditionals, which is next!
Conditionals are used to control your program flow, meaning you can decide what happens in specific cases.
In LOLCODE the keywords are
O RLYmeans "Oh, really?",
YA RLYmeans "Yes, really",
NO WAImeans "No, why?", and
OICmeans "Oh I see!".
Let's make a simple program that determines if two numbers are the same:
10 are the same numbers.
Now let's break the code down. First we have the expression using the comparisons
BOTH SAEM. This checks if
10 are the same. Next, we have
O RLY, which kinda acts like the "beginner" of the conditional; you put all the control flow statements inside it. Then I indented the rest of the code. Indents are irrelevant (they don't affect anything), but they make the code look nice.
After, we have
YA RLY, which is like the
if statement. After the
YA RLY, all the code inside it will be executed only if the condition we first mentioned (
BOTH SAEM 10 AN 10) is true, or
NO WAI is like the
else statement. If the expression is false, everything after it will be run.
Finally, we have
OIC, which ends the loop. Remember to add it at the end!
We can also add as many
MEBBE statements as we want, they are kinda like
elif statements. Bascially they are the same as
YA RLY, but it's used if there are more condiions.
Taking the example from above, let's add and change some code:
As you can see, first we have the expression
BOTH SAEM animal AN "cat", which checks if the animal the user entered is the same as
cat. If yes, (
YA RLY), then it outputs that "Wow catz nice!". Next, we have the first
MEBBE that checks if the user's animal is the same as
dog. If yes, then it outputs a different message. Same thing for the second
MEBBE. Finally, there's the
NO WAI with the messsage "hum other pet?" which will output if any of the above conditions arn't met.
We can also make conditionals based on variable types. We will be using the keywords
WTF?means "What the f**k?",
OMGmeans "Oh my god",
GTFOmeans "Get the f**k out",
OMGWTFmeans "Oh my god what the f**k", and
OICmeans "Oh I see".
Let's make a program that checks if the sum of two numbers are specific numbers:
Alright, that's a lot of code. So first, we have two variables,
b, and we ask the user to give them values. Next, with
SUM OF a AN b, our expression, we next have the line
WTF?. Next, we first check if that expression equals
OMG, and if it does, then it outputs a message. After, there's
GTFO, which kinda "breaks the loop" so the rest of the program can continue. Same thing for the other
Then there's the
OMGWTF which is the final one, and the code in the loop will only execute if the other
OMGs arn't "validated". And finally, there's the
OIC to finish the loop.
You can use loops to repeat certain bits of code for a specific amount of times. Here's the format to make a for loop:
IM IN YR [label/name for loop] UPPIN YR [iterator variable] TIL [expression]
And to end it we use
IM OUTTA YR [label/name for loop]
Seems complicated, but once you get the hang of it you'll find it easier! First, we have the
[label/name for loop] which you can call
LOOP as its easier (but you can call it whatever you want, following the rules for making variable names).
Next, we have
UPPIN YR [iterator variable] which is like in a
C++ loop the
i++. Bascially, the iterator is kinda like the variable that enables you to through a particular object as many times as you want. It'll become more clear with an example later. Before that, there's
UPPIN YR which is for incrementing, or adding 1 to the iterator. For decreasing the iterator, use
NERFIN YR [iterator variable].
Finally, we have
TIL [expression] which just makes the loop go on until a specific condition is met.
Then to end the loop, we have
IM OUTTA YR [label/name for loop], and the label/name is the same as the label/name you first used at the beginning to name you
IM IN YRmeans "I'm in your",
UPPING YRmeans "Making [iterator variable] bigger",
NERFIN YRmeans "Nerfing your (reducing) [iterator variable]",
TILmeans "Till", and
IM OUTTA YRmeans "I'm out of your".
Alright, now an example for the
for loop; let's make a counting program:
So first, we have the variable
iteratorCount that has the initial value of
0. Then, we have the for loop, which we labeled
UPPIN YR iteratorCount, we are adding
1 from that variable every loop. After with
TIL BOTH SAEM iteratorCount AN 11, that is the expression, so the code inside will loop until
iteratorCount = 11. Notice that we say
11 and not
10 because if we put
10, the program would end at
We're at 9, but we want the program to end at
10. The code inside the loop just outputs
"We're at " then with concatenation we put the
iteratorCount, which like I said above, will decrease every loop.
Remember to add
IM OUTTA YR LOOP at the end to conclude the for loop.
While loops in LOLCODE are pretty similar to for loops.
To make a while loop that outputs a message to infinity, you can do something like this:
Aha! There's a small catch, you can't really make it loop over forever, and, uh to be honest, I don't really know. Also as you can see while loops are kinda the same like for loops, so yea that's why I'm not really talking a lot about them.
Functions contain blocks of code that you can use as many times as you need/want. For functions in LOLCODE, we'll be using
HOW IZ I to start it and
IF U SAY SO to "close" the function. We'll also use
YR for adding parameters (variables passed onto the function).
Note: parameters are the names of the variables listed in the function, while arguments are the actual values of passed onto the function.
HOW IZ Imeans "How am I",
YRmeans "Your", and
IF U SAY SOmeans "If you say so".
To declare a function, we do:
HOW IZ I [functionName] YR [argument1] AN YR [argument2] AN YR [argument3] etc. MKAY
You can add more parameters, just add
AN YR then the parameter.
So uh, didn't manage how to make it work on repl.it, but you can learn more about functions in LOLCODE, with several examples here. However, I found a LOLCODE online editor (here), and I managed to make it work there.
So let's make a function that where we can put a name and the program greets them with a message:
So first of all, we call the function with
HOW IZ I then
greeter is the name of the function, you can change it to what you want. Next, the parameters, indicated by
YR. As you can see, I have one parameter;
name, but you can add more if you want, just seperate them with
Next, we return that parameter with
FOUND YR and we use concatenation (
SMOOSH ... MKAY) to output a personalized message to each person. At the end, with
IF U SAY SO, this indicates the end of the function.
Finally, we call the function using
I IZ then then name of the function followed by our arguments, ended with a
MKAY. In the example above, I called the function 3 times, but you can call it more or less than that, each one with a different name. So when the program executes, it will output 3 messages to each of those persons.
Exception handling is basically adding some code so that if the program encounters some errors, it can keep the program running and not make an error appear in front of the user.
The keywords are
O NOES, and
AWSUM THXmeans "Awesome thanks",
O NOESmeans "Oh no", and
KTHXmeans "Ok thanks".
So, hum, didn't get the code to work (sry!!!) on repl.it, so I tried in the LOLCODE IDE I mentioned above, but it doesn't work there, but you can read more about exception handling in LOLCODE here. Tutorialspoint says that:
Please note that as LOLCODE is not maintained regularly, there are no more updates available for LOLCODE exception handling and many other features.
So yea, bummer. =/
Didn't find much about arrays either because (rly sry!!!), and didn't get it to work on repl.it again, but running it in the online LOLCODE IDE I found, it works yay!
Ok so arrays are basically a bit like variables that contain different items. They are a collection which can be changed and reordered. However, there is a limited amount of things you can do with arrays in LOLCODE. Citing a github tutorial:
Array and dictionary types are currently under-specified. There is general will to unify them, but indexing and definition is still under discussion.
So arrays in LOLCODE are called
BUKKITS ("buckets"). To declare an array, you use the same expression as declaring a variable. We shall also be using the keywords
'Z. An example:
HAS A= "Has a",
ITZ= "It is",
So first, we declared the array and named it
array (as it seems pretty appropriate) the same way we would declare and name a variable. In the same line, we also assigned it's data type:
BUKKIT. Next, we're adding, or inserting an item inside the array. The item is the variable called
item1 with the value of
20. So when we output an item of our array,
item1, it outputs
20. This is called accessing.
We can also add more items in our array, like this:
You can also have arrays containing a mix of strings (
YARN), integers (
NUMBR), and floats (
Let's make a simple calculator program that can calculate 2 numbers with 4 operators.
Or if you do a not valid operator output:
So a brief explanation of the above code:
First, we have 3 variables;
number1 for the first number,
number2 for the second number, and
operator for the operator (multiplication, division, addition and subtraction).
Next, we ask the user for those variables with inputs (
And now we have the conditionals. Firstly, we have the expression
BOTH SAEM operator AN "*" which checks if what the user entered as an operator equals
*. If it does, (
YA RLY), then it outputs the multiplication of the 2 numbers the user first entered, with concatenation (
Then, we have 3
MEBBEs (kind of like
elif in python or
else if in
C++) which checks if 3 other expressions are correct. In the conditional branches, they each output a different message with concatenation as well as the result of the equation (
number1 / number2,
number1 + number2, and the last one is
number1 - number2).
So I would have liked it to use an input (
GIMMEH) to ask the user from where to count start the countdown, but for that I would have to convert (casting) what the user wrote from a default
NUMBR so that the
for loop could work, however it didn't work. I tried using another IDE, but it didn't have the expected results.
Anyways explanation of the code: first there's the iterator named
count which has the initial value of
15. You can change it to what you want. Then, the
for loop loops until
count is equal to
-1. Reminder: we say
-1 and not
0, as if it were
0, the countdown would end at
1, but we want it to end at
0. In the loop, outputs what count we're at using concatenation. Finally, we have
IM OUTTA YR LOOP to "close" the loop.
Online LOLCODE IDE: https://www.jdoodle.com/execute-lolcode-online/
Aight so that's about all. I had a lot of fun making this tutorial, hope y'all have fun learning this epic language (with this epic tutorial!)
Have a MIAOOOerful (wonderful) day!!!
Btw check out the repl for some of the code, but if you run it it won't work as some parts like functions, arrays, casting don't work on repl.it =/
Yea also this is part of @elipie's Tutorial Jam yay
Notice that we say 11 and not 10 because if we put 11, the program would end at We're at 9, but we want the program to end at 10.
Isn't it supposed to say "if we put it at 10"? Great tutorial, though I didn't have to use SMOOSH
If anybody read all 5580 words (yes, counted it) within 10 minutes, I would actually be surprised.
HAI 2:02 PM
I HAS A STRING ITZ A YARN
STRING R "DIS IS AWESOME"
I HAS A VAR ITZ 0
IM IN YR COMMENT SECTION NERFIN YER VAR TIL BOTH SAEM VAR AND 1 BTW WILL RUN 4EVUR
VISIBLE "LOLCODE IZ AWSUM"
VISIBLE "LOLCATZ R AWSUM"
@Codemonkey51 WAZ BC IT WAZ TOO COMPLICATED/HARD AND PEEPS NO UNDERSTANDZ! I DID LINK A VERSION WITH THEIR LANGUAGE: https://repl.it/talk/learn/Btw-if-you-want-to-read-the-tutorial-in/79000/349936
OBTW This is my version of the cowntdowner. I guess you weren't able to make the thing overall, but anywhere, here ya go. (Your tutorial taught me the full language in 8 hours)
I HAS A user_input ITZ A NUMBR
VISIBLE "What do you want to count down from?"
MAEK user_input A NUMBR
IM IN YER countdowner NERFIN user_input TIL BOTH SAEM user_input AN 0
VISIBLE "We're at " user_input
IM OUTTA YR countdowner
Seriously, THANK YOU