anyone who knows basic programming and netlango

Oct 01, 2008 18:01

http://lolcode.com It is a Turing-complete language. In other words, you could program in this language.

HelloWorld.lol would look like this

HAI
VISIBLE "OH HAI WURLD!"
KTHXBYE

If compiled and run will print out "OH HAI WURLD!"

Colorz.lol would look like this.

HAI
VISIBLE "COLOR PLZ?"
GIMMEH COLOR
COLOR, WTF?
OMG "R"
VISIBLE "RED FISH"
GTFO
OMG "Y"
VISIBLE "YELLOW FISH"
OMG "G"
OMG "B"
VISIBLE "FISH HAS A FLAVOR"
GTFO
OMGWTF
VISIBLE "FISH IS TRANSPARENT"
OIC
KTHXBYE

This would ask the user "COLOR PLZ?", the user would enter anything.
If user entered “R” :
The program would print "RED FISH"
“Y” :
YELLOW FISH
FISH HAS A FLAVOR
“G” :
FISH HAS A FLAVOR
“B” :
FISH HAS A FLAVOR
none of the above:
FISH IS TRANSPARENT

GTFO means to skip the rest of the following statements.

Here's s'more...

HAI

BTW block comment example
I HAS A VAR ITZ 12
OBTW this is a long comment block
see, i have more comments here
and here
TLDR

BTW variables
I HAS A VAR BTW VAR is null and untyped
VAR R "THREE" BTW VAR is now a YARN and equals "THREE"
VAR R 3 BTW VAR is now a NUMBR and equals 3

BTW some boolean expression formats
BOTH OF [AN] BTW and: WIN iff x=WIN, y=WIN
EITHER OF [AN] BTW or: FAIL iff x=FAIL, y=FAIL
WON OF [AN] BTW xor: FAIL if x=y
NOT BTW unary negation: WIN if x=FAIL
ALL OF [AN] … MKAY BTW infinite arity AND
ANY OF [AN] … MKAY BTW infinite arity OR
DIFFRINT [AN] BTW WIN iff x != y
BOTH SAEM AN BIGGR OF AN BTW x >= y

BTW control flow, if-then
BOTH SAEM
O RLY?
YA RLY
{code block}
[MEBBE
{code block}
[MEBBE
{code block}
…]]
{code block}
NO WAI
{code block}
OIC

BTW control flow, more concrete example
BOTH SAEM ANIMAL AN "CAT"
O RLY?
YA RLY, VISIBLE "J00 HAV A CAT"
MEBBE BOTH SAEM ANIMAL AN "MAUS"
VISIBLE "NOM NOM NOM. I EATED IT."
OIC

BTW function definitions
HOW DUZ I [YR [AN YR …]]

IF U SAY SO

DIAF 0 "epix zlose"
KTHXBYE

Previous post Next post
Up