- Lolcode - Discussion
- Lolcode - Useful Resources
- Lolcode - Quick Guide
- Lolcode - Some More Examples
- Lolcode - Exception Handling
- Lolcode - Functions
- Lolcode - Loops
- Lolcode - Statements & Flow Control
- Lolcode - Input/Output
- Lolcode - Operators
- Lolcode - Types
- Lolcode - Variables
- Lolcode - Syntax
- Introduction & Environment Setup
- Lolcode - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Lolcode - Input/Output
This chapter will explain you how to input a value through LOLCODE terminal and how to output it onto the terminal.
I/O from Terminal
You can use the keyword VISIBLE to print something in LOLCODE. VISIBLE is a function which can take an infinite number of characters as input, and prints them all at once by internally concatenating them, and converting them to strings or YARN.
The VISIBLE function ends or terminates by a depmiter, which is either a pne end or a comma.
The output is automatically terminated by the compiler with a carriage return. If the final token is terminated with an exclamation symbol (!), then the carriage returned is over-ridden by this symbol.
VISIBLE <any_expression> [<any_expression> ...][!]
Please note that in LOLCODE, currently there is no defined standard for printing some data to a file.
To take some input from the user, the keyword used is GIMMEH. It is a function which can take any number of variables as input. It takes YARN as the input and stores the value in any given variable.
GIMMEH <any_variable>
Example
HAI 1.2 I HAS A VAR ITZ A YARN BTW DECLARE A VARIABLE FOR LATER USE VISIBLE "TYPE SOMETHING AND ENTER" GIMMEH VAR BTW GET INPUT (STRING) INTO VARIABLE VISIBLE VAR KTHXBYE
When this code is run, it will ask you to enter a number and then prints the number back in the next pne automatically. When you run this code, it will print the following output −
sh- 4.3$ lci main.lo TYPE SOMETHING AND ENTER 67 67Advertisements