[Question]
  [
Your goal is to create a program that prints itself indefinitely, with a new line after each one. Thus, if your program is a one-liner, it would be repeated on every line of the output.
### Example
Program: 
```
A
```
Output: 
```
A
A
A
...
```
### Rules
* It must be a complete program, not a snippet or function.
* The program should loop forever without stack-overflow or recursion limit errors.
* Output is to stdout or closest alternative.
* No program input is accepted.
* Standard loopholes are disallowed, such as opening the program's file or accessing an external resource. Empty programs are disallowed as a standard loophole.
* If your program code ends with a trailing newline, this does not count as the necessary newline between quines, and you must print another.
* [codegolf](/questions/tagged/codegolf "show questions tagged 'codegolf'") - Shortest code wins!
  
[Answer]
# Fission, 7 bytes
```
'!+!NR"
```
A rather simple modification of [the shortest Fission quine I have found so far](https://codegolf.stackexchange.com/a/50968/8478): I'm simply using the non-destructive `!` instead of `O` and added an `N` for newline.
So all in all, here is how it works: control flow starts at the `R` with a right-going atom. `"` toggles string mode, which means everything until the next `"` is printed: in this case `'!+!NR`. That leaves the `"` and the newline to be printed. `'!` sets the atom's mass to 33, `+` increments it to 34 (the character code of `"`) and `!` prints the quote. `N` prints a newline, and `R` is now a no-op in this case, so the loop starts over.
The following 7-byte solution also works:
```
"NR'!+!
```
[Answer]
# [><>](https://esolangs.org/wiki/Fish), 16 bytes
```
'ard3*o50l2)?.~~
```
The traditional ><> quine uses too many `o`s, so we use a loop for printing. Before each jump we push 5 and 0 (the coordinates of where to jump to), after which we either jump with `.` if there's still something to print, or pops the top two values with `~~`.
(Reverted to the 16 version since I forgot about the stack overflow rule.)
[Answer]
# CJam, 13 bytes
```
{_o"_g
"o1}_g
```
The online interpreter doesn't print anything before the program terminates, so you'll have to test this in the Java interpreter.
## Explanation
Finally a generalised CJam quine which doesn't end in `_~`.
```
{_o"_g
"o1}
```
This simply pushes a block. `_g` duplicates the block and executes it repeatedly while the top of the stack is truthy (discarding the condition).
Now inside the block, the other copy of the block is still on the stack. We duplicate and print it with `_o` and then we print `_g` followed by a newline (the required extra newline between quines) with `"_g\n"o`. Finally we push a `1` onto the stack for the loop to repeat, because unfortunately, blocks aren't truthy (or falsy) in CJam.
[Answer]
# Python 2, 39
Not a very interesting task in Python as it's trivial to add the while loop to a normal quine.
```
c='while 2:print"c=%r;exec c"%c';exec c
```
[Answer]
# Perl 5.10+, ~~40~~ 37 bytes
```
$_=q{say"\$_=q{$_};eval"while 1};eval
```
or (also 37 bytes)
```
$_=q{{say"\$_=q{$_};eval";redo}};eval
```
Invoke with the `-M5.010` or `-E` command line flag, e.g.
```
$ perl -E '$_=q{say"\$_=q{$_};eval"while 1};eval'
$_=q{say"\$_=q{$_};eval"while 1};eval
$_=q{say"\$_=q{$_};eval"while 1};eval
$_=q{say"\$_=q{$_};eval"while 1};eval
...
```
---
Thanks to [Ilmari Karonen](https://codegolf.stackexchange.com/users/3191/ilmari-karonen) for shaving off 3 bytes from my original solution, which was:
```
eval while$_=q{say"eval while\$_=q{$_}"}
```
This, as well as the shorter 37-byte solutions above, are all simple variations of the following quine, which I first saw in one of [Ilmari's other posts](https://codegolf.stackexchange.com/a/37381/31388):
```
$_=q{say"\$_=q{$_};eval"};eval
```
Since all I added in my original solution was a `while` loop, he really deserves most of the credit. :-)
[Answer]
# [Self-modifying Brainf\*\*\* (SMBF)](https://esolangs.org/wiki/Self-modifying_Brainfuck), 14 bytes
The trailing newline `\n` needs to be a literal, Unix, newline (ASCII code 10).
```
[<[<]>[.>]<.]\n
```
### Explanation:
The code moves the pointer to the far left of its source code, then prints it all, including the newline (twice b/c of the rule). The loop continues.
[Answer]
# PowerShell, 143 Bytes
```
$d='$d={0}{1}{0}{2}while(1){3}Write($d -f [char]39,$d,"`n",[char]123,[char]125){4}'
while(1){Write($d -f [char]39,$d,"`n",[char]123,[char]125)}
```
Based off the Rosetta Code PowerShell [quine](http://rosettacode.org/wiki/Quine#PowerShell), I'm pretty confident this isn't the shortest possible. String replacement formatting in PowerShell is icky for this, because the same delimiters for where to put the replacements `{}` also delimit code blocks `while{}`, so we have to use `[char]` casting, which bloats the code a bunch.
[Answer]
# Underload, 25 bytes
First time I've tried something like this and I'm not sure if follows all the rules as it is a couple of lines. The newline was a bit of a pain.
```
(::a~*S:a~*^
)::a~*S:a~*^
```
[Answer]
# [Befunge](http://www.quirkster.com/iano/js/befunge.html), ~~30~~ 20 bytes
```
<,+55,*2+98_ #!,#:<"
```
A variation of a popular befunge quine that prints out a newline and pops -1 on the stack if it finishes the line.  
Unfortunately, Befunge gets verbose when doing things in one line. I tried to remove all of the launchpads (`#`) that i could, but some had to be left in to skip certain commands (like `,`). 
Changes:
**30-20** -> changed the base quine to a custom one I made that uses string input. This way, the branching is a lot easier.
Old:
```
:0g,:93*`>0-10 #,+$#: #5 _1+>
```
I don't think this is optimal, but it's acceptable for now.
[Answer]
# K, 30 bytes
```
{f:$_f;{x}{`0:f,"[]\n";1}/1}[]
```
[Answer]
## R, 34 bytes
```
repeat{write(commandArgs()[5],'')}
```
to invoke from the command line as follows:
```
Rscript -e "repeat{write(commandArgs()[5],'')}"
```
[Answer]
# ><>, ~~31~~ 29 bytes
A simple modification of the traditional [><> quine](http://esolangs.org/wiki/Fish#Quine).
```
"ar00gc0.0+efooooooooooooooo|
```
To run, paste it [here](http://fishlanguage.com/playground), click 'Submit', then 'Start' (running without animation doesn't work). Feel free to increase the execution speed.
[Answer]
# Python 2, 48 bytes
```
c='c=\'%s\';while 1:print c%c';while 1:print c%c
```
[Answer]
# GolfScript, 16 bytes
```
{.".do
":n\p}.do
```
This ended up looking a lot like [Martin Büttner's CJam entry](https://codegolf.stackexchange.com/a/57621). An interesting feature is that, as it turns out, the shortest way to append `".do"` to the block when it's printed is to assign it to the line terminator `n`. (Of course, we also need to include an actual newline in the string, to replace the one `n` normally contains.) The same string (being truthy in GolfScript) is also left on the stack for the `do` loop to pop off, ensuring that the loop runs forever.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 16 bytes
```
∋"∋~kgjẉ₁⊥"gjẉ₁⊥
```
[You can't quite try it online](https://tio.run/##SypKTM6ozMlPN/r//1FHtxIQ12WnZz3c1fmoqfFR11IlJPb//wA "Brachylog – Try It Online"), but I have verified that it works on my installation.
# [Brachylog](https://github.com/JCumin/Brachylog), 18 bytes
```
∋"∋~kgjw₁⊥~n"gjw₁⊥
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r//1FHtxIQ12WnZ5U/amp81LW0Lk8Jzv7/HwA "Brachylog – Try It Online")
Adapted from the alternate version of [this quine](https://codegolf.stackexchange.com/a/183203/85334), with a backtracking hack I had initially devised for [bogosort](https://codegolf.stackexchange.com/a/182062/85334) of all things. Spends two bytes on `~n` because `ẉ` (the usual means for printing with a trailing newline) hits some odd issues with character encoding on TIO, and an actual newline inserted into the string literal gets printed through `~k` as `\n`.
```
               w      Print
 "∋~kgjw₁⊥~n"         "∋~kgjw₁⊥~n"
∋                     which is an element of
                      the (unused and unconstrained) input
                ₁     formatted
          ~n          (so that the ~n is replaced with a newline)
             gj       with itself
   ~k                 (so that the ~k is replaced with the string in quotes),
                 ⊥    then try again.
```
Since `w₁` takes input as a list `[string to be formatted, formatting arguments]`, wrapping a string in a list with `g` then concatenating it to itself with `j` allows it to be formatted with itself. And since no input is given to the program, the input variable which is implicitly present at the beginning of the program can take on any value, so it can be constrained to one of the infinitely many lists which contain `"∋~kgjw₁⊥~n"` as an element, creating a single choice point to be backtracked to when after printing its source the program hits `⊥`.
[Answer]
# [Gol><>](https://github.com/Sp3000/Golfish), 10 bytes
```
"r2sslRoao
```
[Try it online!](https://tio.run/##S8/PScsszvj/X6nIqLg4Jyg/Mf//fwA "Gol><> – Try It Online")
This can probably be golfed down more
[Answer]
# **Python 3.6, ~~48~~ 43 bytes.**
-5 bytes thanks to @Jo King
```
x='while 1:print("x=%r;exec(x)"%x)';exec(x)
```
[Answer]
# BASH, 76 bytes
Just couldn't resist, especially with PowerShell here :)
```
while true;do
a ()
{
    echo while true\;do
    declare -f a
    echo a\;done
}
a;done
```
The whitespace is important for an EXACT copy.
[Answer]
# Javascript (ES6), 64
```
for(;;(_=>console.log(`for(;;(_=>${arguments.callee})());`))());
```
Alternatively (also 64)
```
a="for(;;)console.log(`a=${JSON.stringify(a)};eval(a)`)";eval(a)
```
[Answer]
# [Microscript](https://esolangs.org/wiki/Microscript), 22 bytes
```
"f1{CqxCanx"f1{CqxCanx
```
Based on the quine from the Esolangs article: `"fCqxah"fCqxah`. Exploits the fact that the language autoappends closing braces as needed, without which this would be two bytes longer.
[Answer]
## Batch, 10 (+ 4 for filename length)
Not sure if this qualifies for two reasons: 
* Technically, there may or may not be textual side effects from the Windows command shell, as that depends on how it is configured.
* This program invokes itself by name, and I am not sure whether that's prohibited by the rules (specifically the "no opening of program file" rule). It is not opening itself for the purposes of reading and printing out the text; it is simply re-running itself. Further, the file system structure is an integral part of old-school batch scripts (oftentimes even being used to store program state, etc). As such, I am not sure whether this violates the 5th rule or not.
The code (for a program named q.bat):
```
echo on&&q
```
[Answer]
# [Ceylon](http://ceylon-lang.org/), ~~210~~ 208 bytes
Of course this won't win anything...
```
shared void u(){value q="\"\"\"";value t="""shared void u(){value q="\"\"\"";value t=""";value b="""while(1<2){print(t+q+t+q+";value b="+q+b+q+";"+b);}}""";while(1<2){print(t+q+t+q+";value b="+q+b+q+";"+b);}}
```
Original:
`shared void u(){value q="\"\"\"";value t="""shared void u(){value q="\"\"\"";value t=""";value b="""while(true){print(t+q+t+q+";value b="+q+b+q+";"+b);}}""";while(true){print(t+q+t+q+";value b="+q+b+q+";"+b);}}`
I modified my [Quine from two days ago](https://codegolf.stackexchange.com/a/57935/2338) by adding the `while(true){...}` loop, so I come from the 185 bytes of the plain Quine to 210 (I don't need the trailing new line character anymore). But then I found that a `while(1<2){...}` loop is even two bytes shorter:
`shared void u(){value q="\"\"\"";value t="""shared void u(){value q="\"\"\"";value t=""";value b="""while(1<2){print(t+q+t+q+";value b="+q+b+q+";"+b);}}""";while(1<2){print(t+q+t+q+";value b="+q+b+q+";"+b);}}`
(Ceylon has no `for(;;)` loop like Java, and the braces are also needed for this loop.)
[Answer]
## PowerShell, 132 107 Bytes
```
$a='$a={0}{1}{0};for(){2}$a-f[char]39,$a,[char]123,[char]125{3}';for(){$a-f[char]39,$a,[char]123,[char]125}
```
Based off of the Rosetta Quine (Same as @AdmBorkBork) although doesn't use formatting for string replacement... maybe switching to a for loop and using formatting would be best?
I'm sure if AdmBorkBork came back they would beat this by a lot :P
**EDIT** Figured out the for loop and replacements, all thanks to my predecessor :)
Old attempt:
```
$a='$a=;for(){$a.substring(0,3)+[char]39+$a+[char]39+$a.substring(3)}';for(){$a.substring(0,3)+[char]39+$a+[char]39+$a.substring(3)}
```
[Answer]
# Ruby, ~~41~~ 39 bytes
A modification of [one of the Ruby quines found here](https://stackoverflow.com/a/2475931).
```
_="_=%p;loop{puts _%%_}";loop{puts _%_}
```
[Answer]
# Java 10, 194 bytes
```
interface M{static void main(String[]a){for(var s="interface M{static void main(String[]a){for(var s=%c%s%1$c;;)System.out.println(s.format(s,34,s));}}";;)System.out.println(s.format(s,34,s));}}
```
**Explanation:**
[Try it online](https://tio.run/##lctBCsMgEADAr0iIoJAKpb1Jn5BTjqGHxZiyadXgboUS8nabJ7T3mQUKnJbpWStG9nkG50W/EQOjEyXhJAJgVANnjI/xDnqbU1YFsqBb83@RTpI8t85aPXyIfTDpzWY9JL@iInPIAKyou1w70true/M7rfUL) (times out after 60 sec).
```
interface M{                    // Class
  static void main(String[]a){  //  Mandatory main-method
    for(var s="interface M{static void main(String[]a){for(var s=%c%s%1$c;;)System.out.println(s.format(s,34,s));}}";
                                //   Unformatted source code
        ;)                      //   Loop indefinitely
       System.out.println(      //    Print with trailing new-line:
         s.format(s,34,s));}}   //     The formatted source code
```
[quine](/questions/tagged/quine "show questions tagged 'quine'")-part:
* The String `s` contains the unformatted source code.
* `%s` is used to input this String into itself with the `s.format(...)`.
* `%c`, `%1$c` and the `34` are used to format the double-quotes.
* `s.format(s,34,s)` puts it all together
Challenge part:
* `for(;;)` is used to loop indefinitely.
* `System.out.println(...)` is used to print with trailing new-line
[Answer]
# [Funky](https://github.com/TehFlaminTaco/Funky), 29 bytes
```
f=@print`f=[f]for)f()`for)f()
```
[Try it online!](https://tio.run/##SyvNy678/z/N1qGgKDOvJCHNNjotNi2/SDNNQzMBSv//DwA "Funky – Try It Online")
[Answer]
# [RProgN 2](https://github.com/TehFlaminTaco/RProgN-2), 7 bytes
```
«]³]]p:
```
[Try it online!](https://tio.run/##Kyooyk/P0zX6///Q6thDm2NjC6z@/wcA "RProgN 2 – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 14 bytes
```
“;@ṾṄṛ¢”;@ṾṄṛ¢
```
[Try it online!](https://tio.run/##y0rNyan8//9Rwxxrh4c79z3c2fJw5@xDix41zEXh//8PAA "Jelly – Try It Online")
[Answer]
# Pyth, 11 bytes
```
#jN B"#jN B
```
[Try it here!](https://tio.run/##K6gsyfj/XznLT8FJCUz@/w8A)
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), 16 bytes
```
`{④⑩9⑨,}`{④⑩9⑨,}
```
[Try it online!](https://tio.run/##y05N//8/ofrRxMWPJq60fDRxhU4tKu////@6ybkA "Keg – Try It Online")
Ties with most other golfing languages, so I'm happy with that.
Pushes the string `{④⑩9⑨,}`, which is then infinitely printed rawly, then nicely followed by a newline infinitely.
]