36
\$\begingroup\$

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?

Task

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!

\$\endgroup\$
11
  • 2
    \$\begingroup\$ 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). \$\endgroup\$ Sep 12, 2020 at 13:21
  • 5
    \$\begingroup\$ Possible duplicate of Scream very loudly \$\endgroup\$ Sep 12, 2020 at 14:38
  • 4
    \$\begingroup\$ I don't understand why this was closed. The other challenge is much simpler. \$\endgroup\$ Sep 12, 2020 at 19:28
  • 6
    \$\begingroup\$ @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! \$\endgroup\$
    – null
    Sep 13, 2020 at 11:56
  • 14
    \$\begingroup\$ 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. \$\endgroup\$ Sep 24, 2020 at 8:27

99 Answers 99

1 2 3
4
1
\$\begingroup\$

A0A0, 51 49 bytes

P76
A0A0
A0C3G1G1A0
A0P111P108A0
A0A1G-3G-3A0
G-3

P76 prints a 'L' (ascii code 76), after which the code enters an infinite loop. In this loop, the following code is executed.

P111 P108
P111      ; prints 'o' (ascii code 111)
     P108 ; prints 'l' (ascii code 108)

This prints "ol" infinitely, producing the rest of the infinite output.

Edit: It turns out that the loop does not have a required minimum of three instructions, which allows us to drop a no-op, saving two bytes.

\$\endgroup\$
1
\$\begingroup\$

Rust, 41 bytes

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

Try it online!

\$\endgroup\$
1
\$\begingroup\$

Knight, 14 bytes

;O'L\'W1O'ol\'

Try It Online!

My first Knight answer :D

\$\endgroup\$
0
\$\begingroup\$

Barrel, 8 bytes

L#∞(ol

Implicitly prints L, then infinitely loops over implicitly printing ol. The parenthesis makes o and l into one statement, since a loop can only execute one statement. (In barrel, parentheses are self-closing.)

\$\endgroup\$
0
\$\begingroup\$

Lua, 31 bytes

u=io.write u"L"::x::u"ol"goto x

Try it online!

\$\endgroup\$
2
0
\$\begingroup\$

GForth 30 bytes

: A ." L" 0 1 do ." ol" loop ;
\$\endgroup\$
0
0
\$\begingroup\$

Batch (30 Bytes)

@ECHO OFF
ECHO L
:a
ECHO ol
GOTO :a

If you're willing to ignore @ECHO OFF, then it's 25 bytes instead.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ You could get rid of @echo off without printing echo stuff by prefixing each line (except :a) with @s. Plus, as an alternative solution, you can output without newline by doing set/p=Text to output<nul \$\endgroup\$
    – FZs
    Aug 19, 2021 at 12:04
0
\$\begingroup\$

Arduino, 82 bytes

void setup(){Serial.begin(300);Serial.print("L");}void loop(){Serial.print("ol");}

Arduino nicely splits our program into a "run once" section and a "run forever" section already.

\$\endgroup\$
0
\$\begingroup\$

Alice, 10 bytes

"olL"wo~.K

Try it online!

Explanation

"olL"wo~.K
"olL"       Puts `olL` in the stack, `L` on the top
     w   K  Never ending loop
      o     Print the first element of the stack
       ~    Swap the stack
        .   Duplicate the first element of the stack
\$\endgroup\$
1 2 3
4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.