LOLCODE to JavaScript: Difference between revisions
m Moved page from wikipedia:en:LOLCODE to JavaScript (history) |
m automatic correction by IA |
||
| Line 1: | Line 1: | ||
{{Article for deletion/dated|page=LOLCODE to JavaScript|timestamp=20200929174113|year=2020|month=September|day=29|substed=yes|help=off}} | {{Article for deletion/dated|page=LOLCODE to JavaScript|timestamp=20200929174113|year=2020|month=September|day=29|substed=yes|help=off}} | ||
<!-- Once discussion is closed, please place on talk page: {{Old AfD multi|page=LOLCODE to JavaScript|date=29 September 2020|result='''keep'''}} --> | <!-- Once discussion is closed, please place on talk page: {{Old AfD multi|page=LOLCODE to JavaScript|date=29 September 2020|result='''keep'''}} --> | ||
| Line 12: | Line 11: | ||
==== Example 1 ==== | ==== Example 1 ==== | ||
HAI 1.2 | HAI 1.2 | ||
CAN HAS STDIO? | |||
VISIBLE "HAI WORLD!" | VISIBLE "HAI WORLD!" | ||
KTHXBYE | KTHXBYE | ||
| Line 22: | Line 22: | ||
I HAS A VAR2 ITZ 2 | I HAS A VAR2 ITZ 2 | ||
BOTH SAEM VAR1 AN VAR2, O RLY? | BOTH SAEM VAR1 AN VAR2, O RLY? | ||
YA RLY | |||
VISIBLE "Win" | |||
NO WAI | |||
VISIBLE "Fail" | |||
OIC | |||
KTHXBYE | KTHXBYE | ||
| Line 80: | Line 80: | ||
|Variable Type | |Variable Type | ||
|NUMBR | |NUMBR | ||
|Integer - Whole Number | |Integer - Whole Number | ||
|- | |- | ||
|Variable Type | |Variable Type | ||
Latest revision as of 10:28, 30 March 2025
This article has no lead section. (September 2020) (Learn how and when to remove this template message) |
What is LOLCODE?
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
Example 1
HAI 1.2 CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE
Example 2
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
Example 1 equivalent
console.log("HAI WORLD!");
Example 2 equivalent
var var1 = 1;
var var2 = 2;
if (var1 === var2) {
console.log("Win")
} else {
console.log("Fail")
}
Translation table
| 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.
