You can edit almost every page by Creating an account and confirming your email.

LOLCODE to JavaScript: Difference between revisions

From EverybodyWiki Bios & Wiki
WikiMasterBot2 (talk | contribs)
Add new revision
 
WikiMasterBot2 (talk | contribs)
Line 11: Line 11:
=== LOLCODE examples ===
=== LOLCODE examples ===


====== Example 1 ======
==== Example 1 ====
  HAI 1.2                                                                                                                                            CAN HAS STDIO?
  HAI 1.2                                                                                                                                            CAN HAS STDIO?
  VISIBLE "HAI WORLD!"
  VISIBLE "HAI WORLD!"
  KTHXBYE
  KTHXBYE


====== Example 2 ======
==== Example 2 ====
  HAI 1.2
  HAI 1.2
  CAN HAS STDIO?
  CAN HAS STDIO?
Line 31: Line 31:
=== JavaScript equivalent ===
=== JavaScript equivalent ===


====== Example 1 equivalent ======
==== Example 1 equivalent ====
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
console.log("HAI WORLD!");
console.log("HAI WORLD!");
</syntaxhighlight>
</syntaxhighlight>


====== Example 2 equivalent ======
==== Example 2 equivalent ====
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
var var1 = 1;
var var1 = 1;

Revision as of 09:22, 4 October 2020


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

LOLCODE to JavaScript
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.