Lolcode Tutorial
Lolcode Tutorial
Lolcode Tutorial
i
LOLCODE
This tutorial provides a basic level understanding of the LOLCODE programming language.
Audience
This tutorial is meant for people who want to explore beyond general boring programming
syntax. Readers of this tutorial can learn the programming language in simple and easy
ways.
This tutorial will also be helpful for all those developers who want to learn the basics of
LOLCODE.
Prerequisites
The tutorial assumes that the readers have a knowhow about programming languages. If
you have worked on any other programming language, it will be easier for you to learn
LOLCODE.
All the content and graphics published in this e-book are the property of Tutorials Point (I)
Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish
any contents or a part of contents of this e-book in any manner without written consent
of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely as
possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.
Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our
website or its contents including this tutorial. If you discover any errors on our website or
in this tutorial, please notify us at [email protected]
i
LOLCODE
Table of Contents
About the Tutorial ............................................................................................................................................ i
Audience ........................................................................................................................................................... i
Prerequisites ..................................................................................................................................................... i
Constructs ........................................................................................................................................................ 2
Whitespace ...................................................................................................................................................... 3
Comments ....................................................................................................................................................... 4
Types ............................................................................................................................................................... 9
BUKKIT ........................................................................................................................................................... 12
ii
LOLCODE
Operators ...................................................................................................................................................... 13
Comparison ................................................................................................................................................... 15
Calling Functions............................................................................................................................................ 26
iii
1. LOLCODE – INTRODUCTION AND ENVIRONMENTLOLCODE
SETUP
LOLCODE is an esoteric programming language inspired by the funny things on the Internet.
It is designed to test the boundaries of programming language design.
This chapter will make you familiar with setting up the local environment for LOLCODE,
installing it on Windows, and executing its script online at TutorialsPoint – codingground.
Please note that LOLCODE officially supports direct installation of interpreter for MAC
operating Systems only. To install LOLCODE in your operating system, you need to follow the
steps given below:
Installation on Windows
If you need to install LOLCODE on Windows operating system, please take these steps:
First add MinGW and Python to your environment variables path. To do this, right click
on My Computer, choose Properties, then select Advanced system settings.
Select Environment Variables. In this box, select the PATH variable and then click
Edit.
Next, open the Command Prompt and navigate to the project directory using the
"cd" command, for example.
4
LOLCODE
To execute your scripts easily and swiftly, use the codingground platform provided by
TutorialsPoint. For this, go to the following link to execute your scripts online:
https://www.tutorialspoint.com/execute_lolcode_online.php
5
LOLCODE
2. LOLCODE – SYNTAX
Constructs
The LOLCODE constructs are slang words. The following table shows the alphabetical list of
constructs implemented so far:
6
LOLCODE
VISIBLE <expr> This prints the argument on screen. Note that this does
not print a newline.
YARLY This denotes the start of the "true" conditional block
HAI is hi
KTHXBYE is okay, thanks, bye
BTW is by the way
OBTW is oh, by the way
TLDR is too long; didn't read
Whitespace
In most programming languages, keywords or tokens may not have spaces between them.
However, in some languages, spaces are used in tokens to differentiate them.
Comma
The comma behaves like a newline keyword in most languages, for example, \n in Java and
C. You can write many commands in a single line in LOLCODE, provided that you separate
them using a comma (,).
A comment is terminated by a newline. Please note that the line continuation (...) and (,)
after the comment (BTW) are ignored by the lci.
Comments
Single line comments are written followed by the BTW keyword. They may occur anywhere
inside a program body: it can be at the first line of program, in between the program, in
between some line, or at the end of a program.
7
LOLCODE
In LOLCODE, multiple line comments are written followed by OBTW and they are ended
with TLDR.
File Creation
A LOLCODE program begins with HAI keyword and it should end with KTHXBYE. As LOLCODE
uses shorthand language HAI basically stands for Hi and KTHXBYE can be remembered as
“Ok, thanks, bye ”.
Example
HAI 1.2
I HAS A NAME
VISIBLE "NAME::"!
GIMMEH NAME
VISIBLE "tutorialsPoint " NAME "!"
KTHXBYE
8
LOLCODE