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 '20 at 13:21
• Possible duplicate of Scream very loudly Sep 12 '20 at 14:38
• I don't understand why this was closed. The other challenge is much simpler. Sep 12 '20 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 '20 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 '20 at 8:27

Golang, 53 27 bytes

print("L");for{print("ol")}

Try it online!

EDIT: Apparently package main and func main() don't necessarily count towards the byte count for Go e.g. https://codegolf.stackexchange.com/a/107159/95793.

Previous version:

package main
func main(){print("L");for{print("ol")}}

PHP, 24 bytes

L<?php for(;;)echo'ol';
• -1 byte using a for loop. Sep 28 '20 at 6:51
• -2 by using ol instead of 'ol' and a for loop. May 10 at 17:45

Batch, 42 40 bytes

@set/p=L<nul
:g
@set/p=ol<nul
@goto g

set/p outputs the string after the = as the prompt, and then expects to read from the console, which ends the line when you hit enter. But we redirect the input, so no enter happens, and we simply end up with a infinite series of "prompts" all on one line. Edit: Saved 2 bytes thanks to @T3RROR.

• -2 bytes by changing each @set/ps= to @set/p= May 11 at 14:43

Hexagony, 11 6 bytes

-5 thanks to @Bubbler

L;o;l;

Try it online!

L ;   Executed once: Set memory to 'L' (76) and print
o ; l  Executed repeatedly: Set memory to 'o' (111), print, set memory to 'l' (108)
; .   Executed repeatedly: Print

After the first row is executed once, the second and third rows are repeatedly executed, infinitely printing ol.

• Simply L;o;l; works. Not sure if it can be reduced to 5 bytes, but it might be possible. May 16 at 3:46

FALSE, 13 bytes

'L,[1]["ol"]#

Try it online!

Explanation

'L, // outputs "L" character
[1] // pushes lambda which evaluates to 1 onto the stack
["ol"] // pushes lambda which prints "ol" onto the stack
#   // Executes lambda on top of stack while the lambda below it
// does not evaluate to zero

Note: This is my first post on this site, so let me know in the comments if I did something wrong.

• Welcome to Code Golf! Nice first answer! Doesn't look like you did anything wrong, the formatting and explanation are better than most of my answers :p Jul 26 at 19:02
• @Redwolf Programs Thanks for your feedback! Have a nice day! Jul 26 at 19:09

WedgeScript, 9 bytes

'Lo|"ol"o

Explanation:

'L         Pushes the character literal L to the stack
o          Output
|          Loop the rest of the code infinitely
"ol"       Push the string "ol" to the stack
o          Output

Yes, Wedgescript is a custom language made by me, here is the repo with interpreter install instructions: github.com/WedgeScript/WedgeScript

• Welcome to Code Golf! I've cleaned up the formatting of your answer a bit to make it easier to read the explanation. This language looks really cool! I think I might have to check it out! Aug 5 at 20:55

BitCycle, 30 bytes

v001000<   ~010!

~1011000110^

Try it online!

Outputs as a stream of bits.

• 30 bytes while still avoiding the undefined behaviour of outputting two bits at the same time
– Jo King
Aug 18 at 16:19

Minim, 41 39 Bytes

New solution prepends 3 to the string, saving 2 bytes:

[]=3&"loL".$<[[0]--].[0]=[0]?[0]:2.C=0. With whitespace and comments: [] = 3 & "loL". ; Inserts the value 3, and the string "Lol" backwards, into \ memory from index 0$< [[0]--].          ; Prints the value at the index stored at index 0 as unicode, \
and decrements index 0
[0] = [0] ? [0] : 2. ; Sets index 0 back to 2 if it equals 0
C = 0.               ; Sets the program counter to 0, which advances to 1 afterwards

Old solution used ASCII escape character 0x3 (ETX) in the string:

[]="\x03loL".$<[[0]--].[0]=[0]?[0]:2.C=0. GitHub Repository Python 3, 44 bytes print('L',end='') while 1:print('ol',end='') How it works: The program first prints 'L' and then infinitely prints 'ol' on a single line using the end=''. Try it online! Japt, 14 11 bytes -3 bytes thanks to @Shaggy OoUª'L ß"ol Try it online! Explanation OoUª'L // Output input if it exists else 'L' ß"ol // Run program with input being "ol" • 11 bytes Sep 12 '20 at 22:31 • Or 12 bytes if you want to avoid the overflow. Sep 12 '20 at 23:44 Powershell v5 32 Byte while(1-ne2){Write-Host -n 'lo'} Has someone an idea how to shorten Write-Host? Is there an alias? New One 52 Byte for(1){Write-Host -n 'L' for(1){Write-Host -n 'ol'}} • The first character printed must be a capital L, the rest must be in lower-case. You can maybe answer Scream verly loudly like this. Sep 24 '20 at 11:47 • ...although actually there already a terser Powershell program there. Sep 24 '20 at 11:49 • Thanks for the hint. Sep 24 '20 at 11:53 • You can shorten your answer by 4 characters by removing the not equal expression: while(1){Write-Host -n 'lo'} Sep 24 '20 at 14:45 • 38 bytes with set-alias. 39 bytes with raw powershell Sep 24 '20 at 19:37 Wolfram Language (Mathematica), 31 bytes #0[ol,$Output~WriteString~#]&@L

Try it online!

Stops when the program hits the $IterationLimit, which defaults to 4096. 34 bytes does the job without worrying about that: Do[$Output~WriteString~L;L=ol,∞]

Try it online!

76;["ol":]

Try it!

R, 26 25 bytes

cat('L');repeat cat('ol')

Try it online!

Well, this one is pretty straightforward.

−1 byte thanks to Steffan

Stax, 7 6 bytes

║►yü[c

Run and debug it

Explanation

.Lo{cpvW
.Lo      push two letter string "Lo"
{   W loop forever
c    duplicate           → ["Lo", "Lo"]
p   print and pop       → ["Lo"]
v  lowercase           → ["lo"]
begin next iteration

Scala, 3534 32 bytes

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

Try it online!

• -1 thanks to ovs!
• 1>0 is one byte shorter than true.
– ovs
Oct 20 '20 at 13:11

SABDT, 23 bytes

pr"L";wh(0=0){pr"ol";}

Exspanded:

pr "L";
wh(0 = 0){
pr "ol";
}

the 1st line prints "L".

the 2nd line is a while loop. 0 is a variable reference, since it has not been declared yet it starts as "", an empty string. essentially it is a while true loop.

the 3rd line prints "ol".

• Welcome to the site! Would you mind providing a link to this language, so that others can check/verify your solution? Oct 27 '20 at 11:17
• @caird-coinheringaahing sure thing Oct 27 '20 at 22:54

BRASCA, 14 12 11 bytes

-1 bytes from RezNesX

loLo[:mo]

Try it online!

Explanation

loL         - Push 'Lol' to the stack
o        - Output the 'L'
[:mo]   - Output the next character of ['o', 'l']
• 11 bytes: loLo[:mo] May 12 at 11:52

Fueue, 14 bytes

76):[111)108:]

Try it online!

Explanation

76 is the character code for L, 111 is the code for o, and 108 is the character code for l. This code first prints an L and then goes into an infinite loop that keeps printing out ol.

76):[111)108:]

76              Print 'L'.
):[        ]  Turn the stuff in the brackets into 111)108:[111)108:]
111 108    Print 'ol'.
)   :   Loop infinitely.

Canvas, 6 bytes

LＷol＋］

Try it here!

Constructs an infinite length string.

Explanation:
LWol+] | Full program (characters replaced for clean spacing)
-------+------------------------------------------------------
L      | Push the string "L"
W   ] | While ToS is truthy (without popping),
ol   |  Push the string "ol"
+  |  Add the two strings (i.e. append "ol" to the string)
| Print ToS (implicit) (will not ever actually occur)

Non-empty strings are always truthy in Canvas.

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 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 at 2:46

C# 9, 55 47 bytes

for(var x="L";;x="ol")System.Console.Write(x);

Thanks, @ceilingcat!

Previously on Code Golf

var x="L";while(true){System.Console.Write(x);x="ol";}

Using top-level statements.

Microsoft's online compiler that doesn't like this infinite loop idea...

• Welcome to the site! Would it be possible for you to add in a link to an online interpreter, such as TryItOnline, so others can run your code? Oct 27 '20 at 23:37
• Unfortunately, the only .NET 5.0 online interpreter is on Microsoft's site. This doesn't allow for injecting code. Plus, it locks up on this infinite loop. I'll add the link, but best of luck getting it to run. Oct 27 '20 at 23:42
• @ceilingcat ooo... I didn't think of that... Oct 28 '20 at 15:18

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 '20 at 21:52
• I think this (20 bytes including f=) should work. Sep 24 '20 at 22:55
• @JoKing legit :) I'll edit my answer wiith 2+ Sep 25 '20 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 '20 at 6:07
• What's the result of f()? (It's not "an infinite string" — those don't exist in JavaScript.)
– Lynn
Oct 5 '20 at 21:34

"volL

Flipbit, 24 bytes

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

Try it online!

or, using a bit less odd behavior:

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

Try it online!

C (gcc), 27 bytes

f(i){f(!printf("Lol"+!i));}

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 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 at 20:43
• Thanks @manatwork Aug 5 at 21:12

JavaScript (Node.js), 6050 49 bytes

-10 bytes thanks to @user

-1 byte by replacing while(1) with for(;;)

(p=x=>process.stdout.write(...x))L;for(;;)pol

Try it online!

• 50 bytes
– user
Jul 27 at 21:25
• 48 bytes
– ovs
Aug 6 at 21:59

Vim+startinsert, 14 11 bytes

ol<C-v><C-r>"<C-o>ddL<C-r>"

Try it online!

In TIO, when the recursive register expansion (RRE) times out, nothing is outputted since it didn't finish expanding. In Vim, you may not see anything right away since the console might freeze during the RRE, but if you Ctrl+C, you can stop the expansion and see that it does work.

Explanation:

# '+startinsert' flag - start vim in insert mode; TIO equivalent is 'i' in the header
ol<C-v><C-r>"                 # Insert 'ol<C-r>"'
<C-o>           # Run normal mode command, then return to insert mode:
dd         #   Delete 'ol<C-r>"' into unnamed register
L        # Insert 'L'
<C-r>"  # Insert unnamed register, which recursively expands to 'ol' + unnamed register

Raku, 14 chars, 16 bytes

Per standard rules, an infinite generator is acceptable.

{|<L ol>,~*…*}

Try it online!

Since this can be directly assigned or passed into other functions, the brackets aren't per se necessary but not sure if I can do that (if so, -2 chars/bytes). Enforcing the standard out bit is as simple as add a >>.print adds an extra 8 chars (22 chars, 24 bytes total).

(|<L ol>,~*…*)>>.print

Try it online!