# Shortest infinite loop producing no output

The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.

## Rules

• Each submission must be a full program.
• You must create the shortest infinite loop.
• Even if your program runs out of memory eventually, it is still accepted as long as it is running the whole time from the start to when it runs out of memory. Also when it runs out of memory, it should still not print anything to STDERR.
• The program must take no input (however, reading from a file is allowed), and should not print anything to STDOUT. Output to a file is also forbidden.
• The program must not write anything to STDERR.
• Feel free to use a language (or language version) even if it's newer than this challenge. -Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D
• Submissions are scored in bytes, in an appropriate (pre-existing) encoding, usually (but not necessarily) UTF-8. Some languages, like Folders, are a bit tricky to score - if in doubt, please ask on Meta.
• This is not about finding the language with the shortest infinite loop program. This is about finding the shortest infinite loop program in every language. Therefore, I will not accept an answer.
• If your language of choice is a trivial variant of another (potentially more popular) language which already has an answer (think BASIC or SQL dialects, Unix shells or trivial Brainf**k-derivatives like Alphuck), consider adding a note to the existing answer that the same or a very similar solution is also the shortest in the other language.
• There should be a website such as Wikipedia, Esolangs, or GitHub for the language. For example, if the language is CJam, then one could link to the site in the header like #[CJam](http://sourceforge.net/p/cjam/wiki/Home/), X bytes.
• Standard loopholes are not allowed.

(I have taken some of these rules from Martin Büttner's "Hello World" challenge)

Please feel free to post in the comments to tell me how this challenge could be improved.

## Catalogue

This is a Stack Snippet which generates both an alphabetical catalogue of the used languages, and an overall leaderboard. To make sure your answer shows up, please start it with this Markdown header:

# Language name, X bytes

Obviously replacing Language name and X bytes with the proper items. If you want to link to the languages' website, use this template, as posted above:

Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)

• I've got to start posting programs with a negative byte count to beat all these empty files! – CJ Dennis Oct 3 '15 at 4:32
• This challenge is interesting because it brings out lots of 0 byte languages (some of which are NOT esolangs). FWIW, most declarative languages have an implicit infinite loop because declarative languages don't have loops in their syntax (they assume they're running in an infinite loop). Ladder diagrams are perhaps among the oldest such languages. Then you have the Instruction Language (IL), a sort of assembly for PLCs that also assume an infinite loop. ILs, like assembly are different between manufacturers – slebetman Oct 5 '15 at 9:36
• Are programs that read and execute their own source code allowed, or does file I/O break the "must take no input" rule? – ThisSuitIsBlackNot Oct 6 '15 at 13:05
• @ThisSuitIsBlackNot Yes, file input is allowed. – Kritixi Lithos Oct 6 '15 at 16:47
• Can you print "", an empty string? – OldBunny2800 Mar 7 '16 at 23:39

# Hodor, 22 bytes

hodor............(1){}

Hodor!

Or, (44 bytes)

hodor............(hodor. rhodor!? hodor? ){}

# Smalltalk-80, 8 bytes

(or more)

First there is no such thing as a program in Smalltalk-80, just write a snippet anywhere in a text pane and press the doIt! pop up menu. But we can eventually write snippets that don't stop.

[]repeat

is the obvious infinite loop

thisContext restart

is our kind of goto solution

|x|
x:=[:b|b value: b].
x value:x

is a block closure evaluating itself recursively, but since a closure close over local variables, we can do it shorter:

|b|(b:=[b value])value

Since Smalltalk-80 don't do recursive tail elimination, this infinite loop will starve memory and won't really be infinite.

We also may retry code that raised an exception, if ever the exception was temporary...
(a costly variant of repeat)

[0halt]on:Halt do:[:e|e retry]

We can also play with recursive structures, modulo recursive tail elimination problems:

|x|(x:=1->0)key:x;hash

We can also exploit weaknesses of the interpreter itself - this is in latest Squeak 6.x (you'll have to kill the image):

|c|c:=Class new.c superclass:c.c new

Since new will invoke self basicNew initialize, the interpreter will loop in #initialize method lookup. This time no memory growth, the loop is solid.

There must be some shorter exploit, but I'll stop here, Smalltalk is more talk than small for golfing...

In a certain sense, the interpreter performs an infinite loop itself, so doing nothing is already doing an infinite loop, but that's cheating.
In the case of Smalltalk though, since we save the state of the interpreter in an image, and later resume an image at each restart, we're just running the infinite loop for more than 20 years now (or one of its avatars). Since it's ran over a virtual machine, it even perpetuates across different machines, OS, architectures, so it's a quite robust loop!

# Operation Flashpointscripting language, 4 bytes

@0>1

@ waits until the condition (0>1) is true, which obviously never happens, so it keeps looping and checking the condition forever.

Alternative solution (10 bytes):

#l
goto"l"

This usually freezes the game.

# Implicit, 1 byte

(

Creates a jump point. When the interpreter hits EOF and there is an open jump point, it loops forever.

## REXX, 10 bytes

s:signal s

Of course, the canonical way is a whopping 14 bytes:

do forever
end

Or, depending on implementation:

do forever
nop
end

> 1
>> While 1 1

Try it online!

# Pyt, 3 bytes

1ł

Explanation:

1             Pushes 1 onto the stack
ł           Loops while the top of the stack is not zero

Try it online!

# Acc!!, 21 bytes

Count i while i+1 {
}

Try it online!

In Acc!!, looping is costly. Whitespace between brackets is required and the statement is a bit wordy. This is pretty self-explanatory, but just in case, it increments i until i - (i + 1) = 0, which is never.

# Forked, 0 bytes

Same as the top two answers. Try it online!

# Momema, 4 bytes

j0j1

Try it online!

## Explanation

j  0  #  label j0: jump past label j0 (no-op)
j  1  #  label j1: jump past label j0 (re-execute this instruction)

# Chip-8, 1 byte

0x12

Instructions in Chip-8 are 2 bytes, so 0x12 is interpreted as 0x1200 (assuming the unused parts of the program are filled with zeros)

Instruction 0x1... jumps to the address stored in the lower 1.5 bytes, which is 0x200, the start of program memory.

# FALSE, 5 bytes

[1]$# Explanation: [ {function start} 1 {push 1} ] {push function}$ {duplicate}
# {while loop: pop two functions, run them while the first returns true}

This will quickly use up memory since the body function of the while loop pushes a value which is never popped.

Here's one of the same size which doesn't cause a memory leak, but only works on certain interpreters/compilers:

[1]1#

The second 1 is read as a function pointer, which causes the while loop to jump to the ], skipping the other 1.

# Stax, 1 byte

W

Try it online!

Just an unconditional loop without body.

# axo, 1 byte

_

Try it online!

_  goes to the command at 0,0, which happens to be _

# uBASIC, 7 bytes

1Goto1:

Try it online! Version that produces output may be seen Here

# VBA, 7 Bytes

Anonymous VBE immediate window that takes no input and loops forever

Do:Loop

# Yabasic, 7 bytes

Anonymous Function that takes no input and loops forever.

Do:Loop

Try it online! A version that infinitely outputs 1 may be seen here.

• You might as well combine this answer with your VBA answer, given that they're identical. – caird coinheringaahing Feb 12 '18 at 20:37

# MY-BASIC, 12 bytes

Anonymous While loop that loops forever.

While 1
Wend

Try it online! A version that prints 1 infinitely may be seen here.

# Visual Basic .NET (.NET Core), 44 bytes

Declare Subroutine that takes no input and loops forever.

Module M
Sub Main
Do
Loop
End Sub
End Module

Try it online! A version that outputs 1 infinitely may be seen here.

# PHP 7, 8 bytes

for(;;);

This is the shortest I could think of, it's one shorter then

while(1);
//and
a:goto a;

Try it online

it's 5 more if you count the <?php tag

# Wumpus, 0 bytes

Try it online!

Another 0 byte 2D entry. In Wumpus, the first cell is implicitly created, the pointer is always out of bounds, so it reflects forever.

• I'd have to double check the code, but I think the first cell isn't actually created. Instead the grid has dimensions 0x1 so that the IP is always out of bounds (and then still bounces around the edges of its current OOB cell forever). – Martin Ender Feb 13 '18 at 10:03

))((})({

Try it online!

# Explanation:

))(( pushes 1 on stack
})({ the }...{ loops until TOS = 0 and the )( makes it run as a loop because without the )( the }...{ would eval as }{ and not loop
The code is flipped and added to the end during Pain-Flak interpreting and the code does a infinite loop again.
• Note I found the Brain-Flak answer after I wrote this. This was not just a cheap port :P – Christopher Mar 1 '18 at 19:12

So I suppose I can create a new language and develop its intepreter for this answer, can't I?

Feel free to use a language (or language version) even if it's newer than this challenge. -Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. :D

# Ghrvy...!, 3 bytes

grv

Intepreter written in Python 3

Explanation first (Syntax and functions please see below)

g            # Add 1 to the 1st cell
r           # Loop when 1st cell != 0
v          # Switch between cell manipulation and pointer manipulation
# Implicit end of loop. Since 1st cell is still 1, voilà, infinite loop.

Ghrvy...! is a new programming language developed just after I finished golfing my answer in the challenge Non discriminating programming that I at first typed a lot of ghrvys in the code to meet the requirements. Since it is inspired by brainfuck, it is also the type of cell-pointer esolang. All programs in brainfuck can be transpiled to this language.

Syntax:

g: aGaru  - increase the pointer / value in current cell by 1.
Affects the value by default.
(Japanese for 'going up')
h: Heru   - decrease the pointer / value in current cell by 1.
Affects the value by default.
(Japanese for 'becoming less')
r: Repeat - repeat the next code block (block with indent
greater than the indent of the line where the r
token is on) if r is the last command of the same
line, or else repeat the remaining code on the same
line, when the value in current cell is non-zero.
v: Value  - switch the target of tokens g and h between the
pointer and the value at the pointer.
y: Yee    - Set the value in current cell to a random number in
the range [0, value in next cell] inclusive.
.: Input  - Get a byte from user input and set the value in
current cell to that byte. Supports UTF-8.
!: Output - Output value in current cell as a byte in UTF-8.
The program will wait for a valid UTF-8
representation to output.
Spaces( ) - No meaning when between commands on a line, act as
indentation when at the beginning of a line.
Newlines    - Split code blocks, no meaning.

Since there must be something after the token r and token v does no pointer , cell and I/O manipulations, the program grv can be transpiled to brainfuck as +[].

Messages in the STDERR generated are those generated by the intepreter. No actual output is generated by the Ghrvy...! program itself.

Well, I came up the idea of the language first, and found this challenge may be a good place to show the features ;)

# Sceql, 3 bytes

Make the current byte non-zero, then loop forever. I use this implementation to verify it.

-\/

# Python 3, 37 bytes

Hope I did this correctly

try:
while 1:pass
except:pass

Try/Except will end program when memory runs out.

## Canvas, 2 bytes

¹［

Try it here!

### Explanation:

<num>［<...><｝|］|EOL|EOF>: execute <...> <num> times.
¹: float.MaxValue = ∞

1 9-1

Try it online!

## Explanation

deref 9 -1 ; put value of cell 9 (initially 0) into cell -1, the instruction pointer

The 9 could have been replaced with any integer except -1, 0, or 2.

## Reflections, 5 bytes

v\
\/

Test it!

Explanation:

• v reflects the IP down
• \ reflects the IP right
• / reflects the IP up
• \ reflects the IP left
• v reflects the IP down into the loop again

# Japt, 1 byte

Assumes an unlimited call stack.

ß

Test it

# mIRC v.7.49, 1816 13 bytes

y while (1) y

This produces an infinite loop when no input is given.

The code is written in the mirc alias window, and to use it, just write /y in any chat window or status window. Also note that mIRC freezes when an infinite loop is encountered.