LOLCODE to JavaScript
This article has no lead section. (September 2020) (Learn how and when to remove this template message) |
What is LOLCODE?[edit]
LOLCODE is an esoteric programming language inspired by lolspeak, the language expressed in examples of the lolcat Internet meme. The language was created in 2007 by Adam Lindsay, researcher at the Computing Department of Lancaster University.
The language is not clearly defined in terms of operator priorities and correct syntax, but several functioning interpreters and compilers exist. One interpretation of the language has been proven Turing-complete.
LOLCODE examples[edit]
Example 1[edit]
HAI 1.2 CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE
Example 2[edit]
HAI 1.2 CAN HAS STDIO? I HAS A VAR1 ITZ 1 I HAS A VAR2 ITZ 2 BOTH SAEM VAR1 AN VAR2, O RLY? YA RLY VISIBLE "Win" NO WAI VISIBLE "Fail" OIC KTHXBYE
JavaScript equivalent[edit]
Example 1 equivalent[edit]
console.log("HAI WORLD!");
Example 2 equivalent[edit]
var var1 = 1;
var var2 = 2;
if (var1 === var2) {
console.log("Win")
} else {
console.log("Fail")
}
Translation table[edit]
Type | LOLCODE | JavaScript |
---|---|---|
Starting Line | HAI 1.2 | N/A |
Single-Line Comment | BTW | // |
Multi-Line Comment | OBTW | /* */ |
Variable | I HAS A [Variable Name] ITZ [Variable Value] | var [Variable Name] = [Variable Value] |
Giving a Variable a Type | I HAS A [Variable Name] ITZ A [Type] | |
Variable Type | TROOF - Win/Fail | Boolean - True/False |
Variable Type | NUMBR | Integer - Whole Number |
Variable Type | NUMBAR | Float - Decimal Places |
Variable Type | YARN | String - Text Defined By "" |
Concatenation | SMOOSH [Variables to Concatenate, Separated by AN] MKAY | string.concat(string1, string2, ..., stringX) |
Casting | MAEK [variable] A [type] | ().toString(), String(), Number(), Boolean() |
Casting | [variable 1] R MAEK [variable 2] A [type] | N/A |
This article "LOLCODE to JavaScript" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:LOLCODE to JavaScript. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.