- Lolcode Tutorial
- Lolcode - Home
- Introduction & Environment Setup
- Lolcode - Syntax
- Lolcode - Variables
- Lolcode - Types
- Lolcode - Operators
- Lolcode - Input/Output
- Lolcode - Statements & Flow Control
- Lolcode - Loops
- Lolcode - Functions
- Lolcode - Exception Handling
- Lolcode - Some More Examples
- Lolcode Useful Resources
- Lolcode - Quick Guide
- Lolcode - Useful Resources
- Lolcode - Discussion
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 delimiter, which is either a line 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.
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 line automatically. When you run this code, it will print the following output −
sh- 4.3$ lci main.lo TYPE SOMETHING AND ENTER 67 67
Kickstart Your Career
Get certified by completing the courseGet Started