This tutorial provides a basic level understanding of the LOLCODE programming language.

Similar documents
About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Haskell Programming

This is a brief tutorial that explains how to make use of Sqoop in Hadoop ecosystem.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

This tutorial has been prepared for beginners to help them understand the basic functionalities of Gulp.

You must have a basic understanding of GNU/Linux operating system and shell scripting.

This tutorial will show you, how to use RSpec to test your code when building applications with Ruby.

This is an introductory tutorial designed for beginners to help them understand the basics of Radius.

This tutorial also elaborates on other related methodologies like Agile, RAD and Prototyping.

Parrot is a virtual machine designed to efficiently compile and execute bytecode for interpreted languages.

About the Tutorial. Audience. Prerequisites. Copyright and Disclaimer. PySpark

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Meteor

This tutorial will help you understand JSON and its use within various programming languages such as PHP, PERL, Python, Ruby, Java, etc.

This tutorial has been prepared for beginners to help them understand the simple but effective SEO characteristics.

This is an introductory tutorial, which covers the basics of Jython and explains how to handle its various modules and sub-modules.

Memcached is an open source, high-performance, distributed memory object caching system.

So, this tutorial is divided into various chapters and describes the 5G technology, its applications, challenges, etc., in detail.

Before you start with this tutorial, you need to know basic Java programming.

This tutorial explains how you can use Gradle as a build automation tool for Java as well as Groovy projects.

About Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Euphoria

This tutorial explains the key concepts of Web Dynpro with relevant screenshots for better understanding.

This tutorial provides a basic understanding of how to generate professional reports using Pentaho Report Designer.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright DAX

About the Tutorial. Audience. Prerequisites. Copyright and Disclaimer. Logstash

This tutorial will take you through simple and practical approaches while learning AOP framework provided by Spring.

This tutorial is designed for software programmers who would like to learn the basics of ASP.NET Core from scratch.

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Jenkins

Dart is an open-source general-purpose programming language. It is originally developed by Google and later approved as a standard by ECMA.

Scalable Vector Graphics commonly known as SVG is a XML based format to draw vector images. It is used to draw twodimentional vector images.

SAP Lumira is known as a visual intelligence tool that is used to visualize data and create stories to provide graphical details of the data.

This tutorial will guide users on how to utilize TestLodge in reporting and maintaining the testing activities.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Graph Theory

In this tutorial, we are going to learn how to use the various features available in Flexbox.

This tutorial provides a basic understanding of the infrastructure and fundamental concepts of managing an infrastructure using Chef.

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Django

This tutorial will help you in understanding IPv4 and its associated terminologies along with appropriate references and examples.

Microsoft Excel is a spreadsheet tool capable of performing calculations, analyzing data and integrating information from different programs.

In mainframe environment, programs can be executed in batch and online modes. JCL is used for submitting a program for execution in batch mode.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer ASP.NET WP

Before proceeding with this tutorial, you should have a good understanding of the fundamental concepts of marketing.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

This tutorial will give you a quick start with Consul and make you comfortable with its various components.

Learn C programme. C Programming language. Cloud1 C tutorial

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. TurboGears

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. RichFaces

This tutorial covers a foundational understanding of IPC. Each of the chapters contain related topics with simple and useful examples.

This tutorial is designed for those who would like to understand the basics of i-mode in simple and easy steps.

This tutorial is designed for all those software professionals who are keen on learning the basics of Clojure and how to put it into practice.

This tutorial is designed for all Java enthusiasts who want to learn document type detection and content extraction using Apache Tika.

This tutorial has been designed for beginners interested in learning the basic concepts of UDDI.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer DBMS

This tutorial introduces you to key DynamoDB concepts necessary for creating and deploying a highly-scalable and performance-focused database.

jmeter is an open source testing software. It is 100% pure Java application for load and performance testing.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Laravel

This is a small tutorial where we will cover all the basic steps needed to start with Balsamiq Mockups.

Testing is the process of evaluating a system or its component(s) with the intent to find whether it satisfies the specified requirements or not.

This tutorial is prepared for beginners to help them understand the basic-to-advanced concepts related to GPRS.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Gerrit

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright CICS

This tutorial covers various topics ranging from the basics of Lua to its scope in various applications.

Try the following example using the Try it option available at the top right corner of the below sample code box

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. WordPress

You should have a basic understanding of Relational concepts and basic SQL. It will be good if you have worked with any other RDBMS product.

This tutorial discusses the basics of PouchDB along with relevant examples for easy understanding.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. HCatalog

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Drupal

This is a simple tutorial that covers the basics of SAP Business Intelligence and how to handle its various other components.

This tutorial will teach you how to use Java Servlets to develop your web based applications in simple and easy steps.

In this tutorial, we will understand how to use the OpenNLP library to build an efficient text processing service.

Before you start proceeding with this tutorial, we are assuming that you are already aware about the basics of Web development.

CSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking

WebGL (Web Graphics Library) is the new standard for 3D graphics on the Web, designed for rendering 2D graphics and interactive 3D graphics.

About the Tutorial. Audience. Prerequisites. Disclaimer & Copyright. Avro

CSE373: Data Structure & Algorithms Lecture 23: Programming Languages. Aaron Bauer Winter 2014

This tutorial is intended to make you comfortable in getting started with the Firebase backend platform and its various functions.

Homework #3: CMPT-379 Distributed on Oct 23; due on Nov 6 Anoop Sarkar

This tutorial helps the professionals aspiring to make a career in Big Data and NoSQL databases, especially the documents store.

This tutorial will help computer science graduates to understand the basic-to-advanced concepts related to data warehousing.

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Joomla

Lexical Considerations

In this tutorial, we will discuss the architecture, pin diagram and other key concepts of microprocessors.

1 Lexical Considerations

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

This tutorial is meant for software developers who want to learn how to lose less time on API integrations!

In this brief tutorial, we will be explaining the basics of Elasticsearch and its features.

Adobe Flex Tutorial i

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

Full file at

Before proceeding with this tutorial, you must have a good understanding of Core Java and any of the Linux flavors.

This tutorial is designed for software developers who want to learn how to develop quality applications with clean structure of code.

This tutorial is aimed to give you a crisp understanding of the process of building your own blockchain.

B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

XML-RPC is very easy to learn and use. You can make good use of this tutorial, provided you have some exposure to XML vocabulary.

ITEXT. [Document subtitle]

Memcached is an open source, high-performance, distributed memory object caching system.

Preview from Notesale.co.uk Page 3 of 79

Lexical Considerations

SAMPLE Exam for CSE 450 (2018)

Transcription:

i

About the Tutorial LOLCODE is an esoteric programming language inspired by the funny things on the Internet. LOLCODE is designed to test the boundaries of programming language design. 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. Copyright & Disclaimer Copyright 2016 by Tutorials Point (I) Pvt. Ltd. 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 contact@tutorialspoint.com i

Table of Contents About the Tutorial... i Audience... i Prerequisites... i Copyright & Disclaimer... i Table of Contents... ii 1. LOLCODE INTRODUCTION AND ENVIRONMENT SETUP... 1 Setting Up the Local Environment... 1 Installation on Windows... 1 Executing Script Online with TutorialsPoint - codingground... 1 2. LOLCODE SYNTAX... 2 Constructs... 2 Whitespace... 3 Comments... 4 File Creation... 4 3. LOLCODE VARIABLES... 5 Scope of Variables... 5 Naming Conventions... 5 Declaration and Assignment of Variables... 7 4. LOLCODE TYPES... 9 Types... 9 Untyped (NOOB)... 9 Booleans (TROOFS)... 10 Numerical Types (NUMBR)... 11 Strings (YARN)... 11 BUKKIT... 12 5. LOLCODE OPERATORS... 13 ii

Operators... 13 Comparison... 15 Concatenation of Values... 16 Type Casting... 17 6. LOLCODE INPUT/OUTPUT... 18 I/O from Terminal... 18 7. LOLCODE STATEMENTS AND FLOW CONTROL... 20 Expression Statements... 20 Assignment Statements... 20 Conditional Statements... 20 Case Statements... 22 8. LOLCODE LOOPS... 23 9. LOLCODE Functions... 25 Definition of a Function... 25 Returning Value from a Function... 25 Calling Functions... 26 10. LOLCODE - EXCEPTION HANDLING... 28 11. LOLCODE SOME MORE EXAMPLES... 29 Example 1: Program to Calculate the Power of a Number... 29 Example 2: Program to Make an Array... 30 Example 3: Program to Calculate the Factorial of a Number... 31 Example 4: Program to Design a Calculator... 31 iii

1. LOLCODE INTRODUCTION AND ENVIRONMENT 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. Setting Up the Local Environment The LOLCODE interpreter is written in C Language. It interprets the code written in LOLCODE language on multiple platforms. The LOLCODE interpreter is known as lci, which stands for LOLCODE Interpreter. 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: Press Command+Space, and type Terminal and press enter/return key. Run in Terminal app $ git clone https://github.com/justinmeza/lci.git $ cd lci $ cmake. $ make && make install 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. Now, add ";C:\MinGW\bin;C:\Python32" to the end of that path. Next, open the Command Prompt and navigate to the project directory using the "cd" command, for example. Run the script install.py. Executing Script Online with TutorialsPoint - codingground 4

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

2. LOLCODE SYNTAX LOLCODE LOLCODE has a different syntax compared to other programming languages, however, it is easier to remember. This chapter gives you the basic syntax of LOLCODE. Constructs The LOLCODE constructs are slang words. The following table shows the alphabetical list of constructs implemented so far: LOLCODE Construct Purpose/ Usage BTW It starts a single line comment. DOWN <variable>!!<times> This corresponds to variable = variable - times. Note that "times" is a wut-only language extension. GIMMEH <variable> This represents the input statement. GTFO This is similar to break in other languages and provides a way to break out of a loop. HAI This corresponds to main () function in other languages. It is the program entry point in LOLCODE. HEREZ <label> This is another wut-only language extension and declares a label for use with SHOO I HAS A <type> <variable> This declares a variable of said type. There are three built-in types in LOLCODE: NUMBAH (int) DECINUMBAH (double) WORDZ (std::string) Note that types are a wut-only language extension. IM IN YR LOOP This starts an infinite loop. The only way to exit the loop is using GTFO. Corresponds to for(;;) in other languages IZ <expr1> <operator> This is similar to if operator in other languages. <expr2>?: Conditional Operator is one of: BIGGER THAN, SMALLER THAN, structure SAEM AS. Note that the? at the end is optional. KTHX It ends a block. Corresponds to } KTHXBAI This ends a program NOWAI This corresponds to else PURR <expr> This prints argument on screen, followed by a newline. It is a wut-only language extension. RELSE This corresponds to else (if) SHOO This is another wut-only language extension, that corresponds to goto (the horror!) UP <variable>!!<times> This corresponds to variables = variable + times. Here "times" is a wut-only language extension. 6

VISIBLE <expr> YARLY This prints the argument on screen. Note that this does not print a newline. This denotes the start of the "true" conditional block Some examples of slang terms in LOLCODE are: 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 (,). Three Periods ( ) The three periods ( ) enables you to combine multiple lines of code into a single line or a single command by including (...) at the end of the line. This makes the compiler to treat the content of the next line as the content of previous line only. Infinite lines of code can be written together as a single command, as long as each line is ended with three periods. 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. All of these are valid single line comments: I HAS A VAL ITZ 19 BTW VAL = 19 I HAS A VAL ITZ 19, BTW VAL = 19 7

I HAS A VAL ITZ 14 BTW VAR = 14 In LOLCODE, multiple line comments are written followed by OBTW and they are ended with TLDR. This is a valid multi-line comment: I HAS A VAL ITZ 51 OBTW this is a comment TLDR No it s a two line comment Oops no.. it has many lines here 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

End of ebook preview If you liked what you saw Buy it from our store @ https://store.tutorialspoint.com 9