From ca52d12421788385c83f72a1874e1bb7a8798fc0 Mon Sep 17 00:00:00 2001 From: Zandraa Perjesi Date: Sat, 7 Oct 2017 12:20:11 +0200 Subject: [PATCH] add lolcat folder with basic documentation and a few sample codes --- LOLCODE/LOLCODEBasics.md | 93 ++++++++++++++++++++++++++++++++++++++++ LOLCODE/basicLoop.lol | 5 +++ LOLCODE/helloworld.lol | 3 ++ LOLCODE/likeCats.lol | 15 +++++++ LOLCODE/smaller.lol | 12 ++++++ 5 files changed, 128 insertions(+) create mode 100644 LOLCODE/LOLCODEBasics.md create mode 100644 LOLCODE/basicLoop.lol create mode 100644 LOLCODE/helloworld.lol create mode 100644 LOLCODE/likeCats.lol create mode 100644 LOLCODE/smaller.lol diff --git a/LOLCODE/LOLCODEBasics.md b/LOLCODE/LOLCODEBasics.md new file mode 100644 index 0000000..0398655 --- /dev/null +++ b/LOLCODE/LOLCODEBasics.md @@ -0,0 +1,93 @@ +# LOLCODE :smile_cat: + +LOLCODE is an esoteric programming language with its keywords based on the lolcat internet meme. This language was created by Adam Lindsay in 2007. +This is just a short introduction to the language, but if you would like to dig deeper into how to LOLCODE, there is a good documentation on [github](https://github.com/justinmeza/lolcode-spec/blob/master/v1.2/lolcode-spec-v1.2.md) . +## Basic structure + +The code looks as following: + - HAI [VERSION] -- First line defines what version of LOLCODE the code was written in + - [BUSINESS LOGIC] -- Your code + - KTHXBYE -- Last line, terminates the code + +Example hello world code +``` +HAI 1.2 +VISIBLE "hello world!" +KTHXBYE +``` +## Variables + +* YARN (string) +* NUMBR (integer) +* NUMBAR (floats) +* TROOF (bollean) +* NOOB (untyped) + +LOLCODE's typing is dynamic. Variables with no value assigned are NOOB. +You can cast variables. E.g: casting a YARN yarn to NUMBR would look like: +``` +... +yarn IS NOW A NUMBR +... +``` + +### YARN + +YARNs can be written between double quotation marks ("this is a yarn"). +In LOLCODE ":" is the escape character, therefore can be used for YARN manipulation. +* :) represents a newline (\n) +* :> represents a tab (\t) +* :o represents a bell (beep) (\g) +* :" represents a literal double quote (") +* :: represents a single literal colon (:) + +### Math + +The basic math operators are binary prefix operators. +``` +SUM OF AN BTW + +DIFF OF AN BTW - +PRODUKT OF AN BTW * +QUOSHUNT OF AN BTW / +MOD OF AN BTW modulo +BIGGR OF AN BTW max +SMALLR OF AN BTW min +``` + +### If + +``` + +O RLY? + YA RLY + + [MEBBE + + [MEBBE + + ...]] + [NO WAI + ] +OIC +``` + +If the expression is WIN the code block in YA RLY will run (if), if not then it is checked against the MEBBE (else if) expressions in order if one of them is WIN, its block will run. If none of the expressions evaluated WIN the NO WAI (else) code block will run. + +### Loops + +LOLCODE loops start with IM IN YR LOOP and end with IM OUTTA YR LOOP. Infinite loops must have a GTFO break. You can use UPPIN for incrementing the variable by one and NERFIN for decrementing the variable by one. The loop with TIL runs as long as the expression evaluates FAIL, loop with WILE runs as long as expression evaluates WIN. + +``` +IM IN YR