# Lolololololololololololol

Let us take a break from the brain-wrecking questions and answer some of the simpler ones

You have recently read something extremely funny, and want to express your laughter to the world! But how can you?

You have to display the string: Lolololololololololololololololololololololololololololololololololololololololololololololololololololololololol...

...to STDOUT.

The string should be of infinite length, or will constantly be printed until the end of time.

It is just as simple!

But remember, this is code-golf, so the source code must be as short as possible!

Note: Some languages may throw errors since excecution can be timed out, or for other reasons. That is okay! It can be weird when you laugh forever!

Good luck!

• By the way, standard site rules will allow functions which return the result (e.g. in an infinite generator) making the print to STDOUT part redundant unless you specify that this must be a full program (which I'd advise against, but is allowed). Sep 12, 2020 at 13:21
• Possible duplicate of Scream very loudly Sep 12, 2020 at 14:38
• I don't understand why this was closed. The other challenge is much simpler. Sep 12, 2020 at 19:28
• @thedefault. I don't understand your comment. The difference (requires an extra character to be outputted before the program, and outputs two characters instead of one) is fairly trivial. As you can see, if we remove the print L part and change ol to A, we get an SVL answer!
– null
Sep 13, 2020 at 11:56
• I have reopened this question. I believe the small difference presents interesting golfing opportunities in some languages and, furthermore, that simply porting a solution might well not be competitive. One only needs to look at a few of the answers to see some interesting differences. If people disagree then by all means vote to close again. Sep 24, 2020 at 8:27

# Kotlin(script), 2332 31 bytes

print("L")while(0<1)print("ol")


In Kotlin you need a top level declaration(main function) in order to compile code but Kotlin compiler also allows compiling Kotlin scripts using kotlinc -script lol.kts so yes you can compile one liners without top level direction using a file. this cannot be verified using TIO the only online compiler that I found for Kotlin scripting or Kotlin REPL is this site. In order to test this use command line in right side of the given site and and run the code in these steps:

First create a file:

echo "print(\"L\")while(0<1)print(\"ol\")" > lol.kts"


Then run it like this:

kotlinc -script lol.kts


Try it online!

• Welcome to CGCC! Unfortunately, I'm not sure how to verify this on TIO; are you sure this works? The output is supposed to start with a capital L and print "olololol..."; this seems like it'd print "lollollollol..." (edit: testing with this shows the behavior I expected) May 16, 2021 at 2:34
• @hyper-neutrino You're right this cannot be fully verified on TIO because it doesn't support Kotlin scripts. I missed the first capital L that, I'll fix it. May 16, 2021 at 2:46

# Javascript, 23 22 bytes

(-1 from Jo King)

f=a=>(a?"ol":"L")+f(1)


Try it online!

• @joking yes. Actually, it even fits better to the requirement. Thanks Sep 24, 2020 at 21:52
• I think this (20 bytes including f=) should work. Sep 24, 2020 at 22:55
• @JoKing legit :) I'll edit my answer wiith 2+ Sep 25, 2020 at 14:38
• I'm new to code golf, but it seems to me that task requires text to be printed. So shouldn't console.log() be included in script and increase byte count? Sep 28, 2020 at 6:07
• What's the result of f()? (It's not "an infinite string" — those don't exist in JavaScript.)
– Lynn
Oct 5, 2020 at 21:34

# ><> and Gol><>, 10 bytes

"volL
:>o$ Try it online! (><>) Try it online! (Gol><>) ### How it works "volL Push charcodes of v, o, l, L in that order (L is at the top) "v End string mode > and move to the second row o Pop and print one char (initially L) : o$     Infinite loop: Swap, dup, pop and print one char


# Flipbit, 24 bytes

<<^>>>^>^>>.^<^<^<^<<,^]


Try it online!

or, using a bit less odd behavior:

^[>>>^>^>>.^<^<^<^<<,^<]


Try it online!

# Bash (pure bash), 4334 31 bytes

printf L;for((;;)){ printf ol;}


Thanks manatwork

• printf is shorter than echo -n. : is shorter than true. No need for the single quotes. Aug 5, 2021 at 20:34
• If not done yet, take a look at Tips for golfing in Bash. Using those advices you may reduce this to printf L;for((;;)){ printf ol;}. Aug 5, 2021 at 20:43
• Thanks @manatwork Aug 5, 2021 at 21:12

## C# (50, 45, 42 bytes)

for(var a="L";;)Console.Write(a+(a="ol"));


It works by setting a variable to L, printing that variable, then setting its value to ol; infinitely repeating steps 2 and 3.

Note: Thanks to @ceilingcat and @Browncat Programs for pointing out a shorter alternatives in the comments.

# Pxem, filename only: 11 bytes.

Uses reference implementation feature: doesn't break the loop of .w and .a when stack is empty.

L.o.wol.p.a


OR

L.z.p12ol.a


Try it online!

# Vyxal, 8 bytes

\L₴{‛ol₴


Try it Online!

# Pari/GP, 22 bytes

until(!L=ol,print1(L))


Try it online!

# Pari/GP, 22 bytes

while(!print1(L),L=ol)


Try it online!

# Lexurgy, 33 bytes

a propagate:
*=>ol/_ $*=>L/$ _ o


Explanation:

a propagate: # while the input changed last iteration...
*=>ol/_ $# append "lo" to the end of the input *=>L/$ _ o   # prepend "L" exactly once


(L)S((ol)S:^):^

Try it online!

Prints out L, then ololololololololol...

– null
Mar 15 at 14:30

# Splinter, 11 bytes

A{\o\lA}\LA


Try it online!

Interpreter breaking version. Would run forever otherwise.

# Turbo Assembler, 136 119 bytes

.model small
.code
start:
mov dl,'L'
mov ah,2
int 21h
i:
mov dl,'o'
mov ah,2
int 21h
mov dl,'l'
int 21h
jmp i
end start


Ungolfed version:

.model small
.code
start:
mov dl, 'L'         ; move "L" character to DL register
mov ah, 02h         ; print "L" character
int 21h             ; interrupt
infinity_loop:
mov dl, 'o'         ; move "o" character to DL register
mov ah, 02h         ; print characters
int 21h             ; interrupt
mov dl, 'l'         ; move "l" character to DL register
int 21h             ; interrupt
jmp infinity_loop   ; go to "infinity_loop" label
end start


-17 bytes thanks to @Kamila Szewczyk

Lololololo[...] in action:

# ><>, 12 bytes

"L"v
l"o<o"o


### Explanation

"L"v     // pushes the character 'L' onto the stack and moves to the second line
l"o<o"o  // after outputting the L character, enters an infinite loop of pushing "lo" and outputting both


# Perl 5 (ppencode-cpmpatible), 87 bytes

print q pop xor print chr ord q else while length or print uc chr ord q else and s qq q


Try it online!

## How it works

# NOTE: q x STR x eq ' STR '
# chr ord STR to obtain first character
print q pop xor
print chr ord q else
while
# default variable is initially empty string
length or
# print first L
print uc chr ord q else and
# make sure not to come here
s qq q


# Factor, 29 bytes

"L"write [ "ol"write t ] loop


Try it online!

# COMET II ("CASLシミュレータ （CASL II 対応）" by Daytime), 28 bytes.

The leftmost column shows an address, and one word is two bytes.

0000: 7001 0000 7002 0000
0004: 1210 0012 1220 0014
0008: F000 0002 7120 7110
000C: 1210 006C 1110 0012
0010: 6400 0000 004C 006F
0014: 0002


The simulator seems to output an LF automatically every time OUT is executed, and it requires you to set a break point to see how it works by step by step.

## Original CASL II assembly program (63 bytes)

A START
OUT Z,=2
ST GR1,Z
JUMP A
Z DC 'Lo'
END


## Usage example

Run just for a few steps, as I have no ideas how to scroll back the console.

main=putStr$'L':cycle"ol"  To return an infinite string, only 13 bytes required: 'L':cycle"ol"  # Z80Golf, 9 bytes 00000000: 3E 4C FF 3B 3B F6 20 EE 00000008: 03  Try it online! ## Explanation  ld a,$4C ; Load the ASCII code of "L" into a
rst $38 ; Jump past the end of the program (print "L") and push the next address (loop) to the stack loop: dec sp ; \ dec sp ; _} Push the last value (the address of loop) back to the stack by moving the stack pointer by 2 downwards or$20    ; Switch from uppercase to lowercase (idempotent). $4C ("L") ->$6C ("l"), $6C ("l") ->$6C ("l")
xor $03 ; Toggle A between$6C ("l") and $6F ("o") ; ... the program runs (executes NOPs) until PC =$8000 where it prints A, then returns to the address on the stack (which is always loop)


# BrainCrash, 43 22 bytes.

^^+++++++++++.>>[.<.>]


I'll golf off later.

Try it online!

# Gaia, 9 bytes

:p⌋
Lo”↑∞


Try it online!

The first line is a helper function which prints a copy of its input and returns its input converted to lowercase.

Lo” pushes the string "Lo" to the stack, and ↑∞ calls the above function infinitely. Leading quotation marks can be omitted at the start of a line.

The same could be done in a single line with Lo”⟨:p⌋⟩∞.

# JavaScript (Node.js), 49 bytes

for(i=0;++i;){process.stdout.write(i<2?"L":"ol")}


Try it online!

# APL (Dyalog Unicode), 14 bytes

{∇⍞←'ol'}⍞←'L'


Try it online!

# Pyth, 8 bytes

p\LWp"ol


Try it online!

# Etch, 23 bytes

do
:outnnl"lo";
forever

• This looks like it outputs "lololololol", you need a capital L. Aug 6 at 7:35

# Thue, 35 bytes

L::=~L
()::=(ol)
ol::=~ol
::=
(oLl)


Here is a Thue interpreter that works for this challenge. Paste the code into the box, click Update, and then click Step repeatedly (note that clicking the Run button will lock up your web browser).

Try It Online has a Thue interpreter, but it adds a newline after each print and therefore doesn't match the output format of this challenge.

### Explanation

The program consists of an initial string (oLl) and three rules for transforming it. The rules are applied non-deterministically: any time a rule can be applied to the current string, it may be applied. To achieve predictable behavior, we need to design the string and the rules such that only one of them can be applied at any given point.

Thus, when the string is in its initial state (oLl), the only rule that applies is the first one:

L::=~L


This means "delete L from the string and output L."

Now the string looks like (ol), and the third rule applies:

ol::=~ol


This means "delete ol from the string and output ol."

The string is now (), at which point the second rule applies:

()::=(ol)


This means "replace () in the string with (ol)." Now the string is (ol) again, rule 3 applies again, and we continue ad infinitum.

# Befunge-98 (PyFunge), 1512 11 bytes

'Lv
'l>,'o,


Try it online!
-3 bytes thanks to @emanresuA
-1 byte thanks to @WheatWizard

Befunge-93 compatible version (1 byte more):

L"v
, <,"ol"


Try it online!

• Welcome to Code Golf, and nice first answer! Be sure to check out our Tips for golfing in Befunge page for ways you can golf your program! I think this can be 12 bytes with some rearranging. Mar 17 at 19:26
• @emanresuA thanks! However I can't get over the fact that your code produces Llolo... instead of Lolol... Mar 17 at 20:12
• Oops. I was close... Mar 17 at 20:17
• @WheatWizard thank you too! Mar 18 at 0:28

# Rust, 41 bytes

I know I'm a little late to the party, but I'd though I'd make a Rust contribution. Here's the code:

fn main(){print!("L");loop{print!("ol")}}


Try it online! Note that it will panic on TIO after the output exceeds 128 KiB. But it doesn't panic in my terminal!

## PHP (25 chars)

echo'L';for(;;print'ol');


# Clojure, 24 bytes

This is my first answer in Clojure; I only started learning it recently.

(pr 'L)(while 1(pr 'ol))


To be honest I'm not quite sure myself why (pr 'ol) works, but it does.