# 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:

#[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>

• 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. – user41805 Oct 6 '15 at 16:47
• Can you print "", an empty string? – OldBunny2800 Mar 7 '16 at 23:39

# 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 :)

• Aw, I was gonna post this. :/ – Deusovi Oct 2 '15 at 18:00
• @daniero It may have some relation to this standard loophole.... I personally don't agree with the standard loophole. – Justin Oct 2 '15 at 20:02
• @Justin That loophole only applies to certain types of challenges. – Dennis Oct 2 '15 at 20:32
• You can use <pre>&nbsp;</pre> for an empty-looking code block. – user253751 Oct 3 '15 at 6:17
• First thing I looked for – Dylan Madisetti Oct 12 '15 at 5:20

# L00P, 0 bytes

This lang was made for looping, and that's just what it'll do...

• LOL. +1 for choice of language. – ETHproductions Oct 2 '15 at 18:29
• ... one of these days this lang is gonna loop all over you – Pål GD Oct 3 '15 at 11:05
• +1 for the musical reference, and congrats on another gold badge! – Luis Mendo Jul 1 '16 at 23:35
• The best reference I have seen – Christopher Jul 20 '17 at 16:44

# C64 Machine Code, 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 :)

• Shouldn't this work on any machine with a 6502 / 6510 family processor, not just a C64? Also, what you've written is machine code. The assembly would be BNE -2 – Level River St Oct 2 '15 at 19:54
• +1 for making an actual program that is small, instead of trying to find the most obscure language that just so happens to have the least characters to represent the structure. – Knetic Oct 2 '15 at 20:40
• @user45891 EB FE is x86. 6502/6510 doesn't have an unconditional short jump instruction. – Random832 Oct 2 '15 at 22:21
• Steveverrill, touché, it is machine code, indeed. And yes, I thought more people would recognize the Commodore 64 than the 65xx family in general :) The VIC-20 used the 6502 and would have been able to run this. So, technically, would my 1541 floppy drive... I vaguely recall being able to reprogram the controller on that. Ah, I still miss my C64 :) – James King Oct 3 '15 at 17:32
• Back in the day, a particularly nasty "trick" (imho vandalism) that customers would play on unsuspecting computer store owners was to place two bytes akin to this but for the X86, at the beginning of the bootloader, using DOS' debug. This would effectively brick the machine, and most shop staff lacked the nous to know it wasn't just a dead drive. – Dewi Morgan Oct 11 '15 at 6:56

# Brainfuck, 3 bytes

+[]


Never decrement: never end.

• It's funny when BF beats most other answers. – Rohcana Oct 3 '15 at 15:24
• I had to think of this when I saw the question on SE's start page. – s3lph Oct 3 '15 at 16:03
• My first thought was BF! :D It ended shorter than I thought. – André Christoffer Andersen Oct 3 '15 at 19:16
• Alternative, still same bytes: -[] – Unihedron Jan 19 '18 at 1:08
• I bet there's an interpreter somewhere where ] would work – 12Me21 Mar 25 '19 at 21:55

# ///, 3 bytes

///


Any bonus points for using the language's name as source code?

• I'm honestly surprised that the link actually works, seeing as how it ends with /// ;) – ETHproductions Oct 4 '15 at 1:11
• @ETHproductions That is rather surprising, but if one thinks about it a bit more, it makes some sense; it's just the URL esolangs.org wiki _ _ _ _ – HyperNeutrino May 1 '16 at 22:33
• @AlexL. Not entirely. The web server sees a GET request to /wiki////. While that intended to be a path, the server can do with that information whatever it wants. – Dennis May 2 '16 at 0:54

# Java, 53 bytes

class A{public static void main(String[]a){for(;;);}}


Yay full program requirement!

• God is that verbose... – mınxomaτ Oct 2 '15 at 17:29
• @minxomat Yep, 45 bytes for an empty main :( – Geobits Oct 2 '15 at 17:30
• @minxomat gotta love that OOP – Luke Oct 6 '15 at 15:39
• That ain't OO. Putting code in a class doesn't make it OO any more than putting a rock in the microwave makes it food. – imallett Oct 11 '15 at 5:18
• @imallett Who says rocks aren't food? – Geobits Nov 16 '15 at 1:36

# 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. 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.

• Check if a is true by checking if a is true by checking if a is true by checking...yay recursion! – kirbyfan64sos Oct 8 '15 at 20:20

Infinite recursion of the main function. Should get compiled to a loop due to tail recursion optimization.

main=main

• It compiles, but if run the runtime system detects the loop and throws the <<loop>> exception - at least with ghc. Maybe some other compiler behaves differently. – nimi Oct 3 '15 at 10:23
• Doing runhaskell Loop.hs happily executed it for several minutes on my machine. So, it's at least runnable by an interpreter. I think the <<loop>> runtime exception that ghc throws is purely an implementation detail of the runtime and not part of the Haskell language as specified in any of the Haskell Reports. – GrantS Oct 3 '15 at 17:29
• It's an edge case. runhaskell happily accepts the code but it doesn't loop. It does nothing. However, the challange only requires to create the loop, not to execute it, so I guess it's fine. Have a +1. – nimi Oct 4 '15 at 14:45
• @GrantS: the Haskell language has no such notion as a “loop”; definitions like main = main are semantically in the same bucket as undefined or error "<<loop>>": bottom values ⟂. – ceased to turn counterclockwis Oct 9 '15 at 18:52
• I think the shortest working haskell loop would be: main=main>>main – lovasoa Nov 12 '16 at 14:58

## Python, 9 bytes

Works in both 2 and 3.

while 1:0


Shortened by @FryAmTheEggman

• note, this does produce output when ran in the Python interpreter – Chris_Rands Aug 8 '17 at 15:16
• @Chris_Rands Only in the REPL. – HyperNeutrino Oct 12 '17 at 14:24

# 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         ..1.@...4. ..


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. 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.

• .com on DOS would be much shorter :) – JimmyB Oct 5 '15 at 11:38
• You only get "thousands" of bytes if you let gcc include the startup files. yasm && ld makes executables only about 1k. – Peter Cordes Oct 5 '15 at 19:58

# 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

• How dare you do a intercal program without comefrom – flawr Oct 2 '15 at 20:17
• @flawr Fixed. ;) – kirbyfan64sos Oct 2 '15 at 20:27
• Np, I think we need more Intercal in golfing contests here=) – flawr Oct 2 '15 at 20:50
• Did you say PLEASE? – Daniel M. Oct 2 '15 at 22:39

# Perl, 6 bytes

perl -e '{redo}'


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


## ><>, 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

• Try   for the code block. – TheNumberOne Oct 2 '15 at 17:48
• Why not just use >? – mbomb007 Oct 2 '15 at 20:55
• If this were Chem.SE, I would recommend putting the code in MathJax, too. – hBy2Py Oct 5 '15 at 1:56
• Are we sure an empty program wouldn't be an infinite loop? – Aaron Oct 5 '15 at 9:12
• Get a runtime error trying to execute the empty program: Traceback (most recent call last): File "fish.py", line 493, in <module> instr = interpreter.move() File "fish.py", line 149, in move if self._position[1] > max(self._codebox.keys()): ValueError: max() arg is an empty sequence – Fongoid Oct 6 '15 at 17:40

# LOLCODE, 24 bytes

IM IN YR X
IM OUTTA YR X

• In many LOLCODE interpreters, such as the one on repl.it, HAI and KTHXBYE are unnecessary. – Alex A. Oct 2 '15 at 19:27
• @AlexA. oh, didn't know that. Thanks. – daniero Oct 2 '15 at 19:29

# Motorola MC14500B Machine Code, 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.

• I believe you have found the ultimate golfing language, at least for small tasks...not even Pyth can get this short. +1 – ETHproductions Nov 4 '15 at 18:02
• Be warned that this shows up as 5 bytes on the scoreboard. – Addison Crump Nov 18 '15 at 10:31
• C is Jump, but where to jump? – Kishan Kumar Oct 4 '16 at 4:34
• Wow, you really like this language, huh? :P – MD XF Jun 11 '17 at 0:26
• This will work in any machine language where 0 is a NOP, the instruction pointer wraps around, and the program memory doesn't hold any extra data. – 12Me21 Oct 24 '17 at 17:29

# 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.

• Unless you can give me a compiler that does this by default, you would have to add 3 bytes for the -O2 option. – LegionMammal978 Oct 3 '15 at 0:17
• @LegionMammal978, according to the rules in the challenge, running out of memory is acceptable. That makes the -O2 optimization a "nice-to-have" rather than a requirement. – Mark Oct 3 '15 at 4:22
• If options to the compiler is allowed (and is not counted for the solution count), so why not change the code to l(){l();} and compile it with the options -Dl=main -O2 – wendelbsilva Oct 5 '15 at 21:01
• For comparison, the shortest non-recursive proper loop implementation is 16B: main(){for(;;);}. – Peter Cordes Oct 6 '15 at 21:30
• @wendelbsilva you may nail it even more by changing the code to X (just one byte) and compiling with -DX=main(){main();} – LeFauve Oct 7 '15 at 12:37

# Vim, 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

• Your vimscript is a little long wh1|endw – FDinoff Oct 6 '15 at 4:48
• Could you explain how this works to someone who's not familiar with Vim? – iFreilicht Oct 16 '15 at 11:37
• @iFreilicht qq starts recording into the q buffer. @q replays what's in the q buffer (at this point, nothing). q stops recording, and then @q replays whats in the q buffer, which at this point is the keystrokes @q. So @q replays @q replays @q.... also, writing this many q's makes my brain hurt. – Wayne Werner Dec 28 '15 at 17:04

# 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.

# BASIC (QBasic 4.5), 105 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

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

• Why line number 10? Why not 9? – recursive Oct 3 '15 at 0:01
• or 8 for 8 bytes?:) – MickyT Oct 3 '15 at 0:04
• It's not going to win and it's funnier this way. – CJ Dennis Oct 3 '15 at 4:29
• This could be shorted to: 1 RUN – TOOGAM Oct 3 '15 at 12:43
• @davidjwest Shortest I can do in Sinclair BASIC is: 1 GOTO SIGNUM PI - since constant ints are stored in memory twice, as shorts, so 1 would be 4 bytes, but SIGNUM and PI both use only one byte each. Ah, the old coding tricks we used to use :D Not sure how much memory line numbers take up, if any, so all I can say is it's 3+(line number storage) bytes. – Dewi Morgan Oct 11 '15 at 7:06

# 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).

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:

//+

• Wow, I just answered almost the exact thing in rs at the exact same time. – kirbyfan64sos Oct 2 '15 at 19:12
• @kirbyfan64sos They look very similar, but they actually work quite differently. :) – Martin Ender Oct 2 '15 at 19:13
• Nice job. I was going to try doing the shortest Retina program in Replace mode. I'm curious, can + match empty input repeatedly? – mbomb007 Oct 2 '15 at 21:10
• @mbomb007 I think that would terminate with a 2 after a few iterations. – Martin Ender Oct 3 '15 at 5:34

# TIS Node Type T21 Architecture, 6 bytes

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

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 No OPeration. 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 Jump Relative uncOnditionally. 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. (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. Though, considering what this challenge is, I don't know what you expect to see...

• Wow-ee. That was amazing. – adrian Oct 27 '17 at 2:02
• I always assumed JRO stood for Jump to Relative Offset. – MutantOctopus Jan 23 '18 at 12:52
• @BHustus i think you're right but i wrote this before i had experience with any other assembly language and i didn't know the lingo – undergroundmonorail Jan 23 '18 at 12:56
• I wish I could +10 this answer. I love TIS-100 – Shirkam Mar 2 '18 at 12:49
• I wrote a TIS emulator of my own, so you can now Try It Online. Don't expect much other than a timeout, though. – Phlarx Mar 29 '18 at 21:36

# C#, 3837 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). Thanks Geobits and 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

class B{static int Main()=>Main();}

• Can you save one by using ; instead of {}? I'd test, but online services don't like infinite loops much. – Geobits Oct 2 '15 at 17:44
• @Geobits Ah, yes. How such simple things slip by. – Sven Writes Code Oct 2 '15 at 17:52
• It may depend on compiler, but I saved another character by declaring it as int main and it ran without a return statement. I'm using Microsoft Visual C# 2013 Community Version 12.0.31101.00 Update 4. "class A{static int Main(){for(;;);}}" – MichaelS Oct 3 '15 at 4:40
• @MichaelS Thanks! Worked in 2015 VS for me. – Sven Writes Code Oct 3 '15 at 16:35
• In vs 15, this might be shorter (barely). 35 class B{static int Main()=>Main();} – Michael B Jan 25 '16 at 20:28

# Foo, 3 bytes

(1)


Everyone's favorite programming language! :D

# Perl, 4 bytes

do$0  Executes itself repeatedly. • Very cool. At first I thought this violated the "must take no input" rule since do EXPR reads from a file, which would technically be input, but the OP clarified that file I/O is acceptable. The really cool thing is that unlike the equivalent in Bash, say, this doesn't fork any new processes, so it will continue indefinitely without hitting any memory or process limits. – ThisSuitIsBlackNot Oct 6 '15 at 16:52 # 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. • Why don't you test it, :D – user41805 Oct 3 '15 at 3:23 • I can confirm that this is correct. :) – Martin Ender Oct 3 '15 at 19:01 • @KritixiLithos Because I couldn't find an online interpreter, and I don't prefer to download the interpreter for every language I ever want to test. ;) – ETHproductions Oct 3 '15 at 19:07 • @ETHproductions You don't? Huh. – Martin Ender Oct 5 '15 at 21:35 • TIO shows that an empty program works. – Weijun Zhou Mar 2 '18 at 9:02 # 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. • Well the rules state that there needs to be an infinite loop to qualify. – arodebaugh Apr 20 '17 at 19:56 • @arodebaugh There is. In other words, there is an infinite loop in every Gammaplex program. – jimmy23013 Apr 20 '17 at 20:12 ## Pyth, 2 bytes #  Pyth expects tokens after the forever operator. (That's a space.) # 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! • With bash you can just do $0 in a shellscript and run it, it will invoke itself forever. – TessellatingHeckler Oct 2 '15 at 18:57
• Creative, but boring old while :;do :;done is only 17 bytes. – ThisSuitIsBlackNot Oct 2 '15 at 19:09
• ping>&- 0 works on Linux, where 0 is mapped to localhost. – Dennis Oct 2 '15 at 19:46
• yes! (I thought about using yes but it didn't occur to me to discard the output.) You can save one byte with yes>/dev/null – ThisSuitIsBlackNot Oct 2 '15 at 19:50
• I wasn't aware of that. If it works with BSD yes, great, but I don't think writing to a file complies with producing no output. – Dennis Oct 2 '15 at 20:03

## Common Lisp, 6 characters

(loop)

• Is there something such as Rare Lisp? – flawr Oct 2 '15 at 20:15
• @flawr I'll assume it was just a humorous comment, but Common Lisp is the result of a standardization process that unified a bunch of mostly-but-not-quite compatible languages in the Lisp family. Languages in the Lisp-family that aren't Common Lisp include Scheme, Racket, Emacs Lisp, and Clojure. – Joshua Taylor Oct 3 '15 at 3:07
• Also (a bit longer, but if we didn't have to count parens, it'd be just two bytes): (do()(())). – Joshua Taylor Oct 3 '15 at 3:08
• @JoshuaTaylor I thought about do too, and about making the reader goes on infinite loop but I don't see how to do it shortly. It seems that nothing beats (loop). – coredump Oct 3 '15 at 12:50
• @JoshuaTaylor if you didn't count parens lisp would be the golfiest language of them all – Cyoce Feb 16 '17 at 0:06

# 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.