[Question]
  [
Your task is to create the shortest infinite loop!
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:
```
#[Language name](http://link.to/the/language), X bytes
```
Now, finally, here's the snippet: (Try pressing "Full page" for a better view.)
```
var QUESTION_ID=59347;var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var OVERRIDE_USER=41805;var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=true,comment_page;function answersUrl(index){return"//api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(index,answers){return"//api.stackexchange.com/2.2/answers/"+answers.join(';')+"/comments?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){answers.push.apply(answers,data.items);answers_hash=[];answer_ids=[];data.items.forEach(function(a){a.comments=[];var id=+a.share_link.match(/\d+/);answer_ids.push(id);answers_hash[id]=a});if(!data.has_more)more_answers=false;comment_page=1;getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:true,success:function(data){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}getAnswers();var SCORE_REG=/<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}function process(){var valid=[];answers.forEach(function(a){var body=a.body;a.comments.forEach(function(c){if(OVERRIDE_REG.test(c.body))body='<h1>'+c.body.replace(OVERRIDE_REG,'')+'</h1>'});var match=body.match(SCORE_REG);if(match)valid.push({user:getAuthorName(a),size:+match[2],language:match[1],link:a.share_link,});else console.log(body)});valid.sort(function(a,b){var aB=a.size,bB=b.size;return aB-bB});var languages={};var place=1;var lastSize=null;var lastPlace=1;valid.forEach(function(a){if(a.size!=lastSize)lastPlace=place;lastSize=a.size;++place;var answer=jQuery("#answer-template").html();answer=answer.replace("{{PLACE}}",lastPlace+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link);answer=jQuery(answer);jQuery("#answers").append(answer);var lang=a.language;lang=jQuery('<a>'+lang+'</a>').text();languages[lang]=languages[lang]||{lang:a.language,lang_raw:lang,user:a.user,size:a.size,link:a.link}});var langs=[];for(var lang in languages)if(languages.hasOwnProperty(lang))langs.push(languages[lang]);langs.sort(function(a,b){if(a.lang_raw.toLowerCase()>b.lang_raw.toLowerCase())return 1;if(a.lang_raw.toLowerCase()<b.lang_raw.toLowerCase())return-1;return 0});for(var i=0;i<langs.length;++i){var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}
```
```
body{text-align:left!important}#answer-list{padding:10px;width:500px;float:left}#language-list{padding:10px;padding-right:40px;width:500px;float:left}table thead{font-weight:700}table td{padding:5px}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="language-list"> <h2>Shortest Solution by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr> </thead> <tbody id="languages"> </tbody> </table> </div> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr> </thead> <tbody id="answers"> </tbody> </table> </div> <table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr> </tbody> </table>
```
  
[Answer]
# [Befunge](https://esolangs.org/wiki/Befunge), 0 bytes
Yup. A Befunge program exists in a two-dimensional *playfield* with fixed size which wraps around the edges. With nothing in that space to interfere, the *program counter* runs in an infinite loop by default :) 
[Answer]
# [L00P](http://esolangs.org/wiki/L00P), 0 bytes
This lang was made for looping, and that's just what it'll do...
[Answer]
# [C64 Machine Code](http://www.commodore.ca/manuals/c64_programmers_reference/c64-programmers_reference_guide-05-basic_to_machine_language.pdf), 2 Bytes
```
D0 FE
```
Branches to itself if the zero flag is not set.
Branches are single-byte offsets from the next instruction location, and 254 is -2 in two's complement... the BNE instruction (D0) takes one byte of memory, and the offset takes a second byte, so branching two bytes back branches back to itself. The zero flag is always cleared when code is loaded into memory.
Note that this is not a recursive subroutine call, so you will never run out of memory. Also note that there is no header, compiler, or executable overhead... it is truly a two-byte program :)
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 3 bytes
```
+[]
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fOzr2/38A "brainfuck – Try It Online")
Never decrement: never end.
[Answer]
# [///](https://esolangs.org/wiki////), 3 bytes
```
///
```
[Try it online!](https://tio.run/##K85JLM5ILf7/X19f//9/AA "/// – Try It Online")
Any bonus points for using the language's name as source code?
[Answer]
# [Java (JDK)](http://jdk.java.net/), 53 bytes
```
class A{public static void main(String[]a){for(;;);}}
```
[Try it online!](https://tio.run/##y0osS9TNSsn@/z85J7G4WMGxuqA0KSczWaG4JLEESJXlZ6Yo5CZm5mkElxRl5qVHxyZqVqflF2lYW2ta19b@/w8A "Java (JDK) – Try It Online")
Yay full program requirement!
[Answer]
# Prolog, 5 bytes
```
a:-a.
```
In order to know if predicate `a` is true, you only need to check if predicate `a` is true.
You need to load the file and execute `a`, both with a command-line arguments, eg. `swipl -g a a.pl` with Swi-Prolog. Note that the recursion is likely to be optimized as an infinite loop and shouldn't blow the stack.
Also, this looks like a smiley, but I am not sure how to call it. The dot looks like saliva, so maybe "vegetative state", or "Infiurated programmer with curly hair". Suggestions are welcome.
---
Edit: I look at the rules again and for a full program and no command line arguments you need to add this, as user @radrow pointed out, for a total of **10 bytes**.
```
a:-a.
:-a.
```
Alternatively, for **14** bytes you can have something more poetic:
```
:-repeat,fail.
```
[Answer]
# [Haskell](https://en.wikipedia.org/wiki/Haskell_%28programming_language%29), 9 bytes
Infinite recursion of the main function. Should get compiled to a loop due to tail recursion optimization.
```
main=main
```
[Answer]
## Python, 9 bytes
Works in both 2 and 3.
```
while 1:0
```
Shortened by @FryAmTheEggman
[Answer]
# x86 ELF executable, 45 bytes
Unlike the vast majority of these answers, this is a truly complete program, as in a free-standing executable program.
```
00000000: 7f45 4c46 0100 0000 0000 0000 0000 0100  .ELF............
00000010: 0200 0300 2000 0100 2000 0100 0400 0000  .... ... .......
00000020: ebfe 31c0 40cd 8000 3400 2000 01         [[email protected]](/cdn-cgi/l/email-protection). ..
```
The guts of the program are at byte 0x20 `ebfe`, which is featured in another answer as the smallest NASM program. If you assemble that with NASM however, you get an executable with thousands of un-needed bytes. We can get rid of most of them using the technique outlined [here](http://www.muppetlabs.com/%7Ebreadbox/software/tiny/teensy.html). You may note that this program isn't even as big as the ELF header! This bit of executable golfing malforms the ELF header and program header so they can occupy the same bytes in the file and inserts our program into some unused bytes within the header. Linux will still happily read the header and start execution at offset `0x20` where it spins forever.
[Answer]
# INTERCAL, ~~42~~ 18 bytes
```
(1)DO COME FROM(1)
```
Idea taken from @flawr's comment.
**EDIT:** Holy crap, INTERCAL is actually shorter than C#. I don't know if that's ever happened before...
## 42-byte version
```
DO(1)NEXT
(1)DO FORGET #1
PLEASE DO(1)NEXT
```
[Answer]
# [Perl](https://en.wikipedia.org/wiki/Perl), 6 bytes
```
perl -e '{redo}'
```
From [`perldoc -f redo`](http://perldoc.perl.org/functions/redo.html):
> 
> The redo command restarts the loop block without evaluating the conditional again...Note that a block by itself is semantically identical to a loop that executes once. Thus redo inside such a block will effectively turn it into a looping construct.
> 
> 
> 
I don't see `redo` too often in production code, but it's great for golf! Compare the above to the shortest equivalents with `for`, `while`, and `goto`:
```
for(;;){} # 9 bytes
1while 1  # 8 bytes
X:goto X  # 8 bytes
```
[Answer]
## [><>](http://esolangs.org/wiki/Fish), 1 byte
```
 
```
A single space will cause ><> to go into an infinite loop of NOPs
Other valid single character programs (with no memory requirements) are as follows:
```
>^v</\|_#x!"'{}r
```
In addition, the rules state that your program can run out of memory in which case we can add the following characters to the list of valid 1-byte programs:
```
01234567890abcdefli
```
[Answer]
# [Motorola MC14500B Machine Code](https://www.brouhaha.com/~eric/retrocomputing/motorola/mc14500b/), ~~0.5~~ 0 bytes
### Explanation
According to the manual, the system is configured to have a looping control structure. The program counter counts up to its highest value, wraps back around to zero, and counts up again.
[Answer]
# [LOLCODE](http://esolangs.org/wiki/LOLCODE), 24 bytes
```
IM IN YR X
IM OUTTA YR X
```
[Answer]
# C, 15 bytes
```
main(){main();}
```
Yes, it's possible to call `main()` recursively. If you've got a compiler that does tail-call optimization (say, gcc with the `-O2` option), it doesn't even segfault: the compiler is smart enough to turn the function call into a `goto`.
[Answer]
# [Vim](http://www.vim.org/), 7 keystrokes
Open the editor, preferably without any loaded scripts, for instance like like this from the command line: `vim -u NONE`
```
qq@qq@q
```
# Vimscript, ~~15~~ 8 bytes
Add it in a script, or run it directly by punching the colon (`:`) key first while you're in normal mode
```
wh1|endw
```
[Answer]
# [Labyrinth](https://github.com/mbuettner/labyrinth), 1 byte
```
"
```
A labrinth program executes the same instruction over and over again if there are no neighbors. They also won't end until they execute the `@` instruction.
[Answer]
# [BASIC](https://en.wikipedia.org/wiki/BASIC) (QBasic 4.5), ~~10~~ ~~5~~ 3 bytes
*In the BASIC programming language, RUN is used to start program execution from direct mode, or to start a overlay program from a loader program.* - [Wikipedia](https://en.wikipedia.org/wiki/Run_command)
Edit: This works without a line number in QBasic 4.5, according to @steenbergh
```
RUN
```
Here's the first version I posted. Infinite GOTO loop. Also, it's 10 bytes, which is a nice coincidence!
```
10 GOTO 10
```
[Answer]
# [Retina](https://github.com/mbuettner/retina), 3 bytes
```
+`0
```
If given a single file, Retina uses a Count stage, replacing the input with the number of matches found for the given regex. Here, the regex is `0`. Now `+` loops the stage for as long as the result changes from the previous iteration. So what exactly is happening?
* `0` is matched against the empty input, giving zero matches, so the result is `0`. This is different from the input, so we run this again.
* `0` is matched against the previous output `0`, which now gives one match... so the result is `1`.
* `0` is matched against the previous output `1`, which fails... so the result is `0`.
* ... you get the idea.
The result of the loop iteration alternates between `0` and `1`, which a) ensures that the loop never terminates and b) ensures that we're not running out of memory because the string doesn't grow.
By default, Retina only outputs once the program terminates, so this doesn't print anything (you can change this behaviour by adding a `>` after the `+`, [which will then print the alternating zeroes and ones](https://tio.run/##K0otycxLNPz/X9suweD/fwA)).
As of 1.0, Retina actually also has more traditional while-loops, which you could use with a simpler stage (which doesn't change the string all the time), but they actually require more bytes. One option would be:
```
//+`
```
[Answer]
# TIS Node Type T21 Architecture, 6 bytes
![A single node with NOP written in it](https://i.stack.imgur.com/aLamD.png)
Tessellated Intelligence System nodes are classified as "processing" or "storage" nodes. Storage nodes simply store and retrieve information, and are irrelevant in this case. Remaining are the processing nodes. Node Type T21, or Basic Execution Node, is the most common and simple (as the name would suggest).
Technically, each node can be thought of as an independent computer. In the case of the T21, it is a computer that has two storage registers (one addressable, one not) and an instruction set of 15 commands. It has enough memory to be programmed with up to 15 instructions. All TIS nodes have four ports connecting them to the topologically adjacent nodes. Reading from a port causes that node to hang until the node on the other end writes to it, and writing to a port hangs until that node reads it.
You might be able to tell by now that TIS nodes were never meant to do much on their own. Together, though, they can be quite powerful... well, for their time. Because of these limitations, it's very rare to see someone use only a single node. In fact, a program that takes input and provides output based on it *must* use at least three nodes, as TIS systems feed input into the `UP` port of a node on the top row and take output from the `DOWN` port of a node on the bottom row. There are three rows, so data must pass through at least three nodes to get to the bottom.
Because of these limitations, TIS nodes are intended to *generally* be used somewhat like this:
1. Get input
2. Do something to it
3. Pass it on
4. Return to step 1
Because of this, the limited space for instructions and the fact that nodes simply wait quietly and don't cause trouble when trying to read input that isn't there, a decision was made in their design that makes them very good for this challenge. I'll quote from the TIS-100's reference manual:
> 
> After executing the last instruction of the program, execution automatically continues to the first instruction.
> 
> 
> 
Perfect! Infinite loops are default for TIS nodes.
I very nearly answered this question with a 0 byte answer, claiming that an empty node was an infinite loop. However, I researched further. First, the quote above states that the loop occurs *after executing the last instruction*. Additionally, I tested the implementation. Each node reports a "mode" at all times. It isn't accessible programmatically but it's intended to make debugging easier. Here are the possible modes:
```
 RUN‌ - I am executing an instruction.
READ - I am reading from a port, waiting for it to be written to.
WRTE - I am writing to a port, waiting for it to be read from.
IDLE - I am doing nothing.
```
It turns out that, since each node is an individual computer, they are capable of determining whether or not they have instructions to execute. If not, they remain in the `IDLE` state (likely to save power). As such, I couldn't in good conscience claim that it was "looping"; rather, each node sat quietly, assuming the others were doing something important.
This program that I've submitted is truly an infinite loop, as executing it sets the state of the node to `RUN`. It is as simple as you would expect, `NOP` performs `N`o `OP`eration. Once it's done doing nothing, execution returns to the top of the code: `NOP`.
If you find it unsatisfying that I'm abusing the T21 architecture to create a loop, I offer an alternate solution at the cost of 2 bytes: `JRO 0`. `JRO` means `J`ump `R`elative unc`O`nditionally. Or something, I guess. There's no agreed-upon expanded form of the instructions. Anyway, `JRO` takes a numeric argument and jumps execution by that amount relative to the current position. For example, `JRO 2` skips the instruction that follows it (useful if that instruction is jumped to from somewhere else). `JRO 1` jumps forward one instruction, making it a `NOP`. `JRO -1` jumps back one instruction, effectively performing the previous instruction once every two cycles until the program is halted. And, of course, `JRO 0` jumps to itself, executing itself forever.
At this point you may be thinking:
> 
> Sure, monorail, this all makes sense, but your answer is simply `NOP`. Why is its score 6 bytes?
> 
> 
> 
Good question, thanks for asking. One may naively think that TIS programs should be counted the same way we count programs in multiple files: the number of bytes in all nodes, plus 1 byte for each additional node after the first. However, the TIS golfing community decided this would be unfair for the simple reason that it ignores some of the information required to recreate solutions. A node's neighbours are very important, and that scoring method gives you positional information for free. Instead, we've adopted the format used by the most common TIS emulator, the confusingly-named [TIS-100](http://store.steampowered.com/app/370360/). (Side note: Please don't name emulators after the system they emulate. It's not clever, it's just annoying and makes everyone have to constantly clarify what they're talking about.) It's very simple: The 12 nodes of a TIS-100 device are numbered, left to right and top to bottom, skipping any storage nodes the emulated system has installed. A node numbered `N` containing `# CODE\n# CODE\n CODE` is saved like so:
```
@N
# CODE
# CODE
# CODE
```
And so, a node numbered 0 containing `NOP` is scored according to its representation in this format:
```
@0
NOP
```
Six bytes.
As I often include in my answers in visually-interesting languages, you can [watch the TIS-100 emulator execute this program on YouTube](https://www.youtube.com/watch?v=rKceAYqt5Vg). Though, considering what this challenge is, I don't know what you expect to see...
[Answer]
# Perl, 4 bytes
```
do$0
```
[Executes itself](http://perldoc.perl.org/functions/do.html) repeatedly.
[Answer]
# [C#](https://en.wikipedia.org/wiki/C_Sharp_(programming_language)), 38 37 36 bytes
```
class B{static int Main(){for(;;);}}
```
For loop with no stopping condition.
The return of main should be an int, but since it'll never reach the end this should compile. (Tested in VS 2015 and 2013, also works in [Ideone](https://ideone.com/HUWzB4)). Thanks [Geobits](https://codegolf.stackexchange.com/users/14215/geobits) and [MichaelS](https://codegolf.stackexchange.com/users/45728/michaels).
A shorter version, **35** bytes, can be achieved, but prints `Process is terminated due to StackOverflowException` which I believe violates the third point of not printing anything to stderr. Credit to [MichaelB](https://codegolf.stackexchange.com/users/23300/michael-b)
```
class B{static int Main()=>Main();}
```
[Answer]
# Foo, 3 bytes
```
(1)
```
Everyone's favorite programming language! :D
[Answer]
# [Hexagony](https://esolangs.org/wiki/Hexagony), 1 byte
```
.
```
I don't know much about this awesome language created by @MartinBüttner, but from what I've seen, this should loop infinitely, as there is no `@` to halt the program. `.` is simply a no-op.
[Answer]
# bash + BSD coreutils, ~~23 22 14 6 5~~ 6 bytes
```
yes>&-
```
`yes` outputs "y" forever; `>&-` closes STDOUT.
Thanks @Dennis and @ThisSuitIsBlackNot for help getting the size down!
[Answer]
## Pyth, 2 bytes
```
# 
```
Pyth expects tokens after the forever operator. (That's a space.)
[Answer]
# [Gammaplex](http://esolangs.org/wiki/Gammaplex), 0 bytes
In Gammaplex, it isn't possible to write a program that isn't an infinite loop. So I just write a program that doesn't use input/output.
[Answer]
## Common Lisp, 6 characters
```
(loop)
```
[Answer]
# [Fission](http://esolangs.org/wiki/Fission), 1 byte
There are exactly 4 one-byte solutions:
```
R
```
```
L
```
```
U
```
```
D
```
These four letters indicate that an atom starts there (in the corresponding direction). One of them is required because without an atom the program terminates immediately. Since the source code is only one character in size, the atom will wrap around immediately, and execute the same cell again. However, after the beginning of the program `UDLR` simply act to deflect an incoming atom in the corresponding direction, so they become no-ops in this case.
]