# Shortest code to produce infinite output

Write the shortest code you can that produces an infinite output.

That's all. You code will only be disqualified if it stops producing output at some point. As always in code golf, the shortest code wins.

Here's a list of answers that I think are really clever, so they can get credit:

• All answers disqualified because at some point the Earth will be swallowed by the sun, and at some point the universe will die :P – Doorknob Nov 9 '13 at 20:00
• Does "infinite until your computer crashes" count? <_< – Izkata Nov 10 '13 at 1:39
• If I write mine in Piet, can I count the pixels of the text the other programs used? I believe the smallest possible repeating Piet program would be 6 pixels. That beats Befunge if "off" pixels still count. – DampeS8N Nov 12 '13 at 20:27
• @Izkata So any answer that crashes your computer is also allowed :D – ɐɔıʇǝɥʇuʎs Jul 11 '14 at 20:11
• @Doorknob So really, the challenge is to produce infinite output in a finite amount of time. Sounds easy enough. – Sanchises Apr 10 '15 at 21:15

# ArnoldC, 81 bytes

IT'S SHOWTIME
STICK AROUND 1
TALK TO THE HAND 0
CHILL
YOU HAVE BEEN TERMINATED

Prints 0 forever.

### Explanation

IT'S SHOWTIME            # start program
STICK AROUND 1           # infinite while loop (since 1!=0)
TALK TO THE HAND 0       # print 0
CHILL                    # end loop
YOU HAVE BEEN TERMINATED # end program

# PlatyPar, 3 Bytes

1WA

Explanation:

1    ## push 1 to the stack
W   ## while(stack[-1])

Works the same as my truth machine, except manually inputting the 1 instead of asking for it.

# Detour, 1 bytes

,

Try it online!

, outputs its contents, and passes it on to the next cell (,). In the event of not being given input, a 0 will be passed in.

## BASTARD 30 Bytes

{(., <> {fi out {t 0}(.)})(.)}

This makes use of a few things that are still in question with the spec, but I'm the authour, so what the hell.

Note: BASTARD is still under development, and I haven't finished the spec, or even a rough REPL, so it probably should be disqualified for everything.

### Explanation:

1. Everything has to sit in a {} block.
2. We define a function called . that takes no arguments.
3. The function prints an undefined variable from the stack, which equates to 'nil'.
4. The function also calls itself, thus an infinite loop.
5. We call the infinite function.

Note: Anonymous functions may or may not be introduced in the future. The current syntax proposed would reduce the above to 24 bytes:

{(<> {fi out {t 0}(@)})}

The only new concept here is @, which is a self-reference to the anonymous function.

• I suggest deleting this answer temporarily until you have released the language – SuperJedi224 Mar 1 '16 at 18:03

# Reng v.1.2, 1 byte

Try it here!

n

Pops N and prints N. N is always zero, popping off the empty stack.

• If Reng is newer than this challenge, you should state that in your answer. – Dennis Mar 21 '16 at 3:39

# Fuzzy Octo Guacamole, 3 bytes (Non-Competing)

(non-competing, FOG is newer than the challenge)

(1)

Infinitely outputs 1.

Due to weird implicit output and recursive loops (it executes the code inside the loop using recursion), 1 is outputted by the implicit output.

• Since FOG is newer than this challenge, you should state that in your answer. – Dennis Mar 21 '16 at 3:39
• @Dennis thanks for catching that. – Rɪᴋᴇʀ Mar 21 '16 at 16:06

# Scratch, 3 bytes

(scoring used)
Adds a blank item to list = repeatedly and indefinitely.

• I can't see your script because of a 503 error. I think that using the button to upload an image is better, since it uploads to i.stack.imgur.com. – Erik the Outgolfer Oct 6 '16 at 18:57
• That's because CubeUpload is down at the moment. – weatherman115 Oct 8 '16 at 18:05
• Well, can you posts the ScratchBlocks version of the script at least (golfed)? – Erik the Outgolfer Oct 8 '16 at 18:11

## Burlesque - 2 Bytes

bc

basically just creates an infinite list and outputting infinite lists will obviously produce infinite output.

Don't try this in the online shell because some browsers freeze when trying to render the result because it's huge :) (at some point either the browser stops rendering or the webserver closes the stream).

# Quetzalcoatl (non-competing), 14 chars

while 1: ::' '

This is for an older version of Quetzalcoatl.

• The latest revision of your answers makes it identical to this answer. – Dennis May 6 '16 at 15:41

## Hexagony, 1 byte

!

Try it online!

Prints an infinite amount of 0s by printing the value of the initial memory edge (which happens to be 0) over and over. The ! is executed in a loop because the source code is toroidal.

# Woefully, 49 bytes (newer than challenge)

||| |
|| |
| |
|| |
||| |
|||| |
||||| |
|||||| |

Explanation

v     v represents char pointer, instruction pointer finds first space after the char
|||A|                                                      pointed at by char pointer
||A|  A- Push zero
|A|
||B|
|||B| B- Pop and print (number)
||||B|
|||||B|
||||||B|
[end] End- go back to character char pointer is pointing at. Char pointer has not moved
so it will just execute the same again

## Sonic Pi, 19 Bytes

loop do puts "" end

Sonic Pi is a sound language, but it's also fully a programming language.

• What is sonic pi, for those who don't know? – Rɪᴋᴇʀ May 6 '16 at 15:33

# zsh (8 chars)

</dev/z*

Analogous to cat /dev/zero.

Note: This does depend on there not being any other files in /dev starting with z, other than /dev/zero.

• Given that this particular configuration of /dev is the default on many UNIX-like operating systems (e.g. Ubuntu, which I had easily available to test), I'm pretty sure there are "implementations" where this works. – user62131 Nov 26 '16 at 21:36

TI-83 Hex Assembly, 6 bytes

PROGRAM:I
:AsmPrgm
:EF0A45
:C3959D

Run with Asm(prgmI). Prints garbage over and over again. The only way to stop the printing is to physically remove the batteries from the calculator and re-insert them, at which point the calculator's RAM will be cleared. I count each hex digit pair as one byte.

# Casio FX-7000G, 6 bytes

Lbl 0◢
Goto 0

This uses the calculator's own encoding, where each token is stored as a byte.

Lbl 0 sets the label of the first line to 0. The triangle means "print last value", which is in this case 0. The next line is your standard Goto statement, jumping back to the top so the value can be printed again.

Due to the calculator's limitations, the user must press EXE after each printed value before the next can be displayed.

• Very cool. The FX-7000G was cutting-edge tech in the mid 80s. Reminds me of my old FX-3900P (RIP) – roblogic Jul 29 '19 at 10:20

# Labyrinth, 1 byte

!

Labyrinth's stack has implicit zeroes at the bottom and the ! character outputs the integer representation of top of the stack. Since the program never finds anywhere else to go besides this single character, it keeps repeating that instruction.

for{print(0)}

Try it online!

# 8th, 24 19 bytes

: f 0 . recurse ; f

The word f pushes a 0 on the stack and print it in a recursive way

• Won't that fail with a "stackoverflow" ? (i.e. does 8th recognize the tail recursion?) – zeppelin Jan 17 '17 at 22:30
• @zeppelin - 8th implements "tail-call elimination" and the above mentioned code runs smoothly. See this post for further explanation. – Chaos Manor Jan 18 '17 at 6:45

# SmileBASIC, 6 bytes

?EXEC.

? is print, EXEC runs a program, and . is the same as 0.0.

If newlines don't count as output, here's a 7 byte answer:

?.EXEC.

?. = PRINT 0.0, EXEC. = EXEC 0.0

# Commodore 64/VIC-20 assembly, 8 bytes (assembled)

033C LDA #$40 033E JSR$FFD2
0341 JMP $033E When executed with SYS 828, this will continuously output the @ character to the screen using the Kernal routine to print. If you don't care what you're outputting, then you can remove 033C LDA #$40 and save two whole bytes (the last thing in the accumulator will be outputted).

• If you remove the code at 033C then you will need to execute with SYS 830, unless you start the code at 033C and change JMP 033E accordingly. – Shaun Bebbers Feb 16 '17 at 12:16

## Alice, 1 byte

o

Prints null bytes indefinitely.

[1+!_]

Try it online!

# Decimal, 12 bytes

11D91D30191D

Try it online!

Explanation:

11D   ; push whatever's in RAM to the stack as an INT
91D   ; declare jump 1
301   ; print
91D   ; goto jump 1

Another version that does not invoke undefined behavior:

82D   ; builtin - push random INT to stack
91D   ; declare jump 1
301   ; print
91D   ; goto jump 1

## Check, 3 bytes (non-competing)

#<#

Outputs infinite newlines.

Check is my new esolang. It uses a combination of 2D and 1D semantics.

### Explanation

This uses a bit of a hack in the language - namely, that < means "print a newline" in 1D mode, and "move left" in 2D mode.

The IP first runs into a #, which turns it into 2D mode. However, it runs into <, which immediately points it back. It runs into the first # again and switches back to 1D mode. The IP then hits <, which outputs a newline, and then hits the second #, which switches it back to 2D mode again. The IP wraps around to the first #, where it switches back to 1D mode. It hits < again, printing another newline, and the process repeats.

• ...how is that 7 bytes? – MD XF Jun 6 '17 at 4:11
• @MDXF I guess I awarded myself extra bytes for not being able to count. – Esolanging Fruit Jun 6 '17 at 5:00

'"""""'"""'"'"""

Try it online!

• Aren't Unreadable programs supposed to use the > '"""""'"""'"'""" markdown, to live up to its name? – caird coinheringaahing Dec 10 '17 at 14:52

# MOO, 39 38 bytes

while(!suspend(player:tell()))endwhile

Huge abuse of side effects; player:tell() by default does not return a value, which means it implicitly returns zero, and the resulting suspend(0) is necessary to avoid running out of ticks.

# Cubically, 3 bytes

%0)

This should look like this:

(%0)
(    open loop that can always be jumped to
%0   print 0th face sum as integer (0)
) jump back to loop regardless of faces

However, ) will just jump back to the start of the file if no jump point is provided.

# Dyalog APL, 5 bytes

⍞←⍣⊢0

⍞← character output

(f⍣g)Y power operator repeatedly applies left operand to the argument until (f Y) g Y returns true. In this case f is the assignment to output and g is which returns the right argument, which is always 0 as the assignment doesn't modify it.

Note that the right operand could also be any of ⊣≠≢

• Nothing to worry about, TIO limits you to 128 kb and 1 minute: Try it online! – Adám Aug 22 '17 at 15:47

# JavaScript, 20 bytes

for(;;)console.log()

Sends infinite undefined output.

#0

Exlanation:

#0
#  Loop forever
0 Print 0