[Question]
  [
Write a program or function which will provably **print all integers exactly once** given infinite time and memory.
Possible outputs could be:
```
0, 1, -1, 2, -2, 3, -3, 4, -4, …
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9, 10, 11, …
```
This is not a valid output, as this would never enumerate negative numbers:
~~```
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …
```~~
* The output must be in decimal, unless your language does not support decimal integer (in that case use the natural representation of integers your language uses).
* Your program has to work up to the numbers with the biggest magnitude of the standard integer type of your language.
* Each integer must be separated from the next using any separator (a space, a comma, a linebreak, etc.) that is not a digit nor the negative sign of your language.
* The separator must not change at any point.
* The separator can consist of multiple characters, as long as none of them is a digit nor the negative sign (e.g. `,` is as valid as just `,`).
* Any supported integer must eventually be printed after a finite amount of time.
### Scoring
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in bytes wins
### Leaderboard
```
var QUESTION_ID=93441,OVERRIDE_USER=41723;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
```
```
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;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="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><div id="language-list"> <h2>Winners 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><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]
## Haskell, 19 bytes
```
do n<-[1..];[1-n,n]
```
Produces the infinite list `[0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7...` 
Haskell allows infinite lists natively. Printing such a list will prints its elements one a time forever.
[Answer]
# Brainfuck, 6 bytes
This makes use of the cell wrapping and prints all possible values. In Brainfuck, the native integer representation is by [byte value](https://codegolf.meta.stackexchange.com/questions/4708/can-numeric-input-output-be-in-the-form-of-byte-values/4719#4719).
```
.+[.+]
```
[Try it online!](http://brainfuck.tryitonline.net/#code=LitbLitd&input=&args=&debug=on)
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), ~~14~~ 12 bytes
```
.(.\OSo;?.>~
```
[Test it online!](http://ethproductions.github.io/cubix/?code=LiguXE9Tbzs/Lj5+&input=&speed=20) You can now adjust the speed if you want it to run faster or slower.
### How it works
The first thing the interpreter does is remove all whitespace and pad the code with no-ops `.` until it fits perfectly on a cube. That means that the above code can also be written like this:
```
    . (
    . \
O S o ; ? . > ~
. . . . . . . .
    . .
    . .
```
Now the code is run. The IP (instruction pointer) starts out at the top left corner of the far left face, pointed east. Here's the paths it takes throughout the course of running the program:
[![enter image description here](https://i.stack.imgur.com/XcEPV.png)](https://i.stack.imgur.com/XcEPV.png)
The IP starts on the red trail at the far left of the image. It then runs `OSo;`, which does the following:
* `O` Print the TOS (top-of-stack) as an integer. At the beginning of the program, the stack contains infinite zeroes, so this prints `0`.
* `S` Push `32`, the char code for the space character.
* `o` Print the TOS as a character. This prints a space.
* `;` Pop the TOS. Removes the `32` from the stack.
Now the IP hits the `?`, which directs it left, right, or straight depending on the sign of the TOS. Right now, the TOS is `0`, so it goes straight. This is the blue path; `.` does nothing, and the IP hits the arrow `>`, which directs it east along the red path again. `~` takes the bitwise NOT of the TOS, changing it to `-1`.
Here the IP reaches the right edge of the net, which wraps it back around to the left; this again prints the TOS (this time `-1`) and a space.
Now the IP hits the `?` again. This time, the TOS is `-1`; since this is negative, the IP turns left, taking the green path. The mirror `\` deflects the IP to the `(`, which decrements the TOS, changing it to `-2`. It comes back around and hits the arrow; `~` takes bitwise NOT again, turning the `-2` to `1`.
Again the TOS is outputted and a space printed. This time when the IP hits the `?`, the TOS is `1`; since this is positive, the IP turns right, taking the yellow path. The first operator it encounters is `S`, pushing an extra `32`; the `;` pops it before it can cause any trouble.
Now the IP comes back around to the arrow and performs its routine, `~` changing the TOS to `-2` and `O` printing it. Since the TOS is negative again, the IP takes the green path once more. And it just keeps cycling like that forever\*: red, green, red, yellow, red, green, red, yellow..., printing in the following cycle:
```
0 -1 1 -2 2 -3 3 -4 4 -5 5 -6 6 -7 7 -8 8 -9 9 -10 10 ...
```
## TL;DR
This program repeatedly goes through these 3 easy steps:
1. Output the current number and a space.
2. If the current number is negative, decrement it by 1.
3. Take bitwise NOT of the current number.
### Non-separated version, 6 bytes
```
nO?~>~
```
Removing the separation simplifies the program so much that it can fit onto a unit cube:
```
  n
O ? ~ >
  ~
```
\* **Note**: Neither program is truly infinite, as they only count up to 252 (where JavaScript starts to lose integer precision).
[Answer]
# [Sesos](https://github.com/DennisMitchell/sesos), ~~113~~ 3 bytes
```
0000000: c4ceb9                                            ...
```
[Try it online!](http://sesos.tryitonline.net/#code=c2V0IG51bW91dAoKam1wCiAgICBwdXQsICAgZndkIDEKICAgIHN1YiAxLCBwdXQKICAgIHJ3ZCAxLCBhZGQgMQ&input=) Check *Debug* to see the generated SBIN code.
### Sesos assembly
The binary file above has been generated by assembling the following SASM code.
```
set numout
jmp ; implicitly promoted to nop
    put,   fwd 1
    sub 1, put
    rwd 1, add 1
; jnz (implicit)
```
[Answer]
## Python 2, 27 bytes
```
n=0
while 1:print~n,n,;n+=1
```
Prints `-1 0 -2 1 -3 2 -4 3 ...`
[Answer]
# [MATL](http://github.com/lmendo/MATL), 8 bytes
```
0`@_@XDT
```
This uses MATL's default data type, which is `double`, so it works up to `2^53` in absolute value. The output is
```
0
-1
1
-2
2
···
```
[**Try it online!**](http://matl.tryitonline.net/#code=MGBAX0BYRFQ&input=)
### Explanation
```
0            % Push 0
  `     T    % Do...while true: infinite loop
   @_        % Push iteration index and negate
     @       % Push iteration index
      XD     % Display the whole stack
```
[Answer]
# [Shakespeare Programming Language](http://shakespearelang.sourceforge.net/report/shakespeare/), 227 bytes
```
.
Ajax,.
Puck,.
Act I:
Scene I:
[Enter Ajax,Puck]
Puck:You ox!
Ajax:Be me without myself.Open thy heart.
Scene II:      
Ajax:Be thyself and ash.Open thy heart.Be me times you.Open thy heart.Be me times you.Let us return to scene II.
```
Obviously, this answer is nowhere near winning, but I liked that this is a use case that the SPL is comparatively well suited to.
Explained:
```
// Everything before the first dot is the play's title, the parser treats it as a comment.
.
// Dramatis personae. Must be characters from Shakespeare's plays, again with a comment.
Ajax,.
Puck,.
// Acts and scenes serve as labels. Like the whole play, they can have titles too,
// but for the sake of golfing I didn't give them any.
Act I:
// This scene would've been named "You are nothing"
Scene I:
// Characters can talk to each other when on stage
[Enter Ajax,Puck]
// Characters can assign each other values by talking. Nice nouns = 1, ugly nouns = -1.
Puck: You ox!                 // Assignment: $ajax = -1;
Ajax: Be me without myself.   // Arithmetic: $puck = $ajax - $ajax;
      Open thy heart.         // Standard output in numerical form: echo $puck;
// Working title "The circle of life"
Scene II:
// Poor Ajax always doing all the work for us
Ajax: Be thyself and ash.          // $puck = $puck + (-1);
      Open thy heart.              // echo $puck;
      Be me times you.             // $puck *= $ajax;  (remember $ajax==-1 from scene I)
      Open thy heart.              // echo $puck;
      Be me times you.             // negate again
      Let us return to scene II.   // infinite goto loop
```
As you can see when comparing this code to [my answer to the related challenge to count up forever](https://codegolf.stackexchange.com/questions/63834/count-up-forever/74426#74426) (i.e. print all natural numbers), SPL code length grows rather badly when problem size increases...
[Answer]
## GNU sed, 189 + 2(rn flags) = 191 bytes
This is most likely the longest solution, since sed has no integer type or arithmetic operations. As such, I had to emulate an **arbitrary size** increment operator using regular expressions only.
```
s/^/0/p
:
:i;s/9(@*)$/@\1/;ti
s/8(@*)$/9\1/
s/7(@*)$/8\1/
s/6(@*)$/7\1/
s/5(@*)$/6\1/
s/4(@*)$/5\1/
s/3(@*)$/4\1/
s/2(@*)$/3\1/
s/1(@*)$/2\1/
s/0(@*)$/1\1/
s/^@+/1&/;y/@/0/
s/^/-/p;s/-//p
t
```
**Run:**
```
echo | sed -rnf all_integers.sed
```
**Output:**
```
0
-1
1
-2
2
-3
3
etc.
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~9~~ 6 bytes
Saved 3 bytes thanks to [Adnan](https://codegolf.stackexchange.com/users/34388/adnan)
```
[ND,±,
```
[Try it online!](http://05ab1e.tryitonline.net/#code=W05ELMKxLA&input=)
Prints `0, -1, 1, -2, 2 ...` separated by newlines.
[Answer]
# Brainfuck, 127 bytes
```
+[-->+>+[<]>-]>-->+[[.<<<]>>-.>>+<[[-]>[->+<]++++++++[-<++++++>>-<]>--[++++++++++>->-<<[-<+<+>>]]>+>+<]<<<[.<<<]>>.+.>[>>>]<<<]
```
[Try it online!](http://brainfuck.tryitonline.net/#code=K1stLT4rPitbPF0-LV0-LS0-K1tbLjw8PF0-Pi0uPj4rPFtbLV0-Wy0-KzxdKysrKysrKytbLTwrKysrKys-Pi08XT4tLVsrKysrKysrKysrPi0-LTw8Wy08KzwrPj5dXT4rPis8XTw8PFsuPDw8XT4-LisuPls-Pj5dPDw8XQ)
Given an infinite tape would theoretically run forever.
```
0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7,8,-8,9,-9,10,-10,11,-11,12,-12,13,-13,14,-14,15,-15,16,-16,17,-17,18,-18,19,-19,20,-20,21,-21,22,-22,23,-23,24,-24,25,-25,26,-26,27,-27,28,-28,29,-29,30,-30,31,-31,32,-32,33,-33,34,-34,35,-35,36,-36,37,-37,38,-38,39,-39,40,-40,41,-41,42,-42,43,-43,44,-44,45,-45,46,-46,47,-47,48,-48,49,-49,50,-50,51,-51,52,-52,53,-53,54,-54,55,-55,56,-56,57,-57,58,-58,59,-59,60,-60,61,-61,62,-62,63,-63,64,-64,65,-65,66,-66,67,-67,68,-68,69,-69,70,-70,71,-71,72,-72,73,-73,74,-74,75,-75,76,-76,77,-77,78,-78,79,-79,80,-80,81,-81,82,-82,83,-83,84,-84,85,-85,86,-86,87,-87,88,-88,89,-89,90,-90,91,-91,92,-92,93,-93,94,-94,95,-95,96,-96,97,-97,98,-98,99,-99,...
```
**Uncompressed**
```
+[-->+>+[<]>-]>-->+
[
  [.<<<]>>-.>>+<
  [[-]>[->+<]
    ++++++++[-<++++++>>-<]>--
    [++++++++++>->-<<[-<+<+>>]]>+>+<
  ]<<<
  [.<<<]>>.+.>
  [>>>]<<<
]
```
[Answer]
# R, ~~25~~ 24 bytes
Golfed one byte thanks to @JDL.
```
repeat cat(-F,F<-F+1,'')
```
[Try it online!](https://tio.run/##K/r/vyi1IDWxRCE5sURD103HzUbXTdtQR11d8/9/AA "R – Try It Online")
Example output:
```
0 1 -1 2 -2 3 -3 4 -4 5 -5 6 -6 7 -7 8 -8 9 -9 10 
```
[Answer]
# [ShadyAsFuck](https://esolangs.org/wiki/ShadyAsFuck), 3 bytes
```
FVd
```
Explanation:
```
F     prints the current cell value (0) and increases it by 1
 V    starts a loop and prints the current value
  d   increases the current value and ends the loop
```
This makes use of the cell wrapping and prints all possible values. In SAF, the native integer representation is by [byte value](http://meta.codegolf.stackexchange.com/questions/4708/can-numeric-input-output-be-in-the-form-of-byte-values/4719#4719).
[Answer]
# [Poetic](https://mcaweb.matc.edu/winslojr/vicom128/final/index.html), 565 bytes
```
even as a child, i had a dream i was a person in the movies
it makes a lot of sense,i did think
o,a million people was an image in mind
i inspire folks to see a comedy
o-m-g,how i am funny
o,i mean i laugh,i cry,i scream,i am the funniest
i made a comedy i was pretty proud of
like a galaxy,i am given a star on a big California byway
i make a movie,i make a sequel to a film i edited
i had a vision i was a celeb;as in,an actor
i had a dream i had a legacy
i am asleep now
i quietly awaken
was it truth,or nothing but a fantasy world?o,a whole lot of doubts for me
```
[Try it online!](https://mcaweb.matc.edu/winslojr/vicom128/final/tio/index.html?XVFLdoQwDNtzCh@AOUEXXfQkhhjww4lpPkNz@qnNTNv3ugErcWRZojslwAII88YSRmDYMBgMmTAaOq/Lg3LRBJygbgRR70xl4AoRd/J70Qq6QKFUaGQIHKyR0z7oiBBZhO31QXoIPRmNK@JKzhg5hYGtKgdngkVlL1DVyMhlaaTQB73F2zpuepok07W0lOzQRkVyLhBs62Zwzt2@ZXb149Xqgr3dFFcbEzH80b72OzLV2u2nLdgag/DuPSsKfvUny8qXUVAqZlCvJl7hA4UXzYkN9hP7xX@9vSwaf2Ghz0biWyEsLG4sBa7kiz/9vnNxj34Mn0loerOS02gL4lw1D/@zeSKhFWcfbWdYhOiApKfhz8ZUpQOeJiINTmyR1dzqNmq2Jo9ohalVV4WpYulwapbw7rGdm1par2SDtqkWCyeb44/HhOEb)
Outputs the following forever:
`0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7,8,-8,9,-9,10,-10,11,-11,`...
[Answer]
## Batch, 56 bytes
```
@set n=0
:l
@echo %n%
@set/an+=1
@echo -%n%
@goto l
```
Output:
```
0
-1
1
-2
2
-3
```
etc. Works up to 2147483647; 58 bytes if you want (-)2147483648 in the output:
```
@set n=0
:l
@echo %n:-=%
@set/an-=1
@echo %n%
@goto l
```
44 bytes if printing all supported positive integers, then all supported negative integers, then repeating endlessly, is acceptable:
```
@set n=0
:l
@echo %n%
@set/an+=1
@goto l
```
[Answer]
# Bash + GNU utilities, 26
```
seq NaN|sed '1i0
p;s/^/-/'
```
[Answer]
## bc, ~~17~~ 16 bytes
**Edit:** 1 byte less thanks to [Digital Trauma](/users/11259/digital-trauma).
Adding to the diversity of languages used so far, I present a bc solution that works with integers of **arbitrary size**. A newline is required after the code and it is counted in the bytes total.
```
for(;;){i;-++i}
```
In the first iteration `i` is not defined, but printing it gives 0 to my surprise.
[Answer]
# Java 7, ~~151~~ ~~134~~ ~~122~~ 118 bytes
```
import java.math.*;void c(){for(BigInteger i=BigInteger.ONE,y=i;;i=i.add(y))System.out.println(y.subtract(i)+"\n"+i);}
```
12 bytes saved thanks to *@flawr* (and *@xnor* indirectly)
# After rule change.. (~~59~~ ~~56~~ 63 bytes)
```
void c(){for(int i=0;i>1<<31;)System.out.println(~--i+"\n"+i);}
```
Since in Java `2147483647 + 1 = -2147483648`, we can't simply do `i++` and continue infinitely, since the challenge was to print all numbers once. With the above code with added range, it will instead print all integers from `-2147483648` to `2147483647` once each, in the following sequence: `0, -1, 1, -2, 2, -3, 3, -4, ..., 2147483646, -2147483647, 2147483647, -2147483648`. Thanks to *@OlivierGrégoire* for pointing out Java's behavior regarding `MIN_VALUE-1`/`MAX_VALUE+1`. [Try it here.](https://ideone.com/iz5mKG)
**Ungolfed & test code:**
[Try it here - resulting in runtime error](https://ideone.com/hDicLq)
```
import java.math.*;
class M{
  static void c() {
    for(BigInteger i = BigInteger.ONE, y = i; ; i = i.add(y)){
      System.out.println(y.subtract(i) + "\n" + i);
    }
  }
  public static void main(String[] a){
    c();
  }
}
```
**Output:**
```
0
1
-1
2
-2
3
-3
4
-4
5
-5
...
```
[Answer]
# Powershell, ~~20~~ ~~19~~ 18 bytes
Improved by stealing shamelessly from TimmyD's answer 
```
0;for(){-++$i;$i}
```
Output:
```
0
-1
1
-2
2
-3
3
-4
4
```
Old version:
```
for(){-$i;$i++;$i}
```
Not sure why tbh, but -*undeclared variable* (or -$null) is evaluted as 0, which saved us 2 bytes in this version...
[Answer]
# [DC (GNU or OpenBSD flavour)](https://rosettacode.org/wiki/Category:Dc) - 16 bytes
This version is not shorter than the version below but should be able to run without the stack exploding in your PC. Nevertheless infinite large numbers will take up infinite amounts of memory... somewhen...
Because of the `r` command it needs [GNU-DC or OpenBSD-DC](https://rosettacode.org/wiki/Category:Dc).
```
0[rp1+45Pprdx]dx
```
Test:
```
$ dc -e '0[rp1+45Pprdx]dx' | head
0
-1
1
-2
2
-3
3
-4
4
-5
```
---
# [DC](https://rosettacode.org/wiki/Category:Dc) - 16 bytes
A little bit mean now. ;-)
This version is abusing the stack length as counter while letting the stack grow.
```
z[pz45Ppllx]dslx
```
Test:
```
$ dc -e 'z[pz45Ppllx]dslx' | head
0
-1
1
-2
2
-3
3
-4
4
-5
```
---
# [DC](https://rosettacode.org/wiki/Category:Dc) - 17 bytes
Without dirty tricks.
```
0[p1+45Ppllx]dslx
```
Test:
```
$ dc -e '0[p1+45Ppllx]dslx' | head
0
-1
1
-2
2
-3
3
-4
4
-5
```
[Answer]
# C# 74 bytes
```
class P{void Main(){for(var x=0m;;System.Console.Write(x+++","+-x+","));}}
```
---
```
class P
{
    void Main()
    {
        for(var x = 0m; ; System.Console.Write(x++ + "," + -x + ","));
    }
}
```
Output:
```
0,-1,1,-2,2,-3,3,-4,4,-5,5,-6,6,-7,7,-8,8,-9,9,-10,10,...
```
Try it:
[`dotnetfiddle.net`](https://dotnetfiddle.net/wwbWhi) (limited to 1000)
[Answer]
## [Labyrinth](http://github.com/mbuettner/labyrinth), 9 bytes
```
!`
\:"
 (
```
[Try it online!](http://labyrinth.tryitonline.net/#code=IWAKXDoiCiAo&input=)
This also works and is essentially the same:
```
 "
`:(
\!
```
### Explanation
The control flow in this code is rather funny. Remember that the instruction pointer (IP) in a Labyrinth program follows the path of non-space characters and examines the top of the stack at any junction to decide which path to take:
* If the top of the stack is positive, turn right.
* If the top of the stack is zero, keep moving straight ahead.
* If the top of the stack is negative, turn left.
When the IP hits a dead end, it turns around (executing the command at the end only once). And the IP starts in the top left corner moving east. Also note that the stack is implicitly filled with an infinite amount of zeros to begin with.
The program starts with this short bit:
```
!    Print top of stack (0).
`    Multiply by -1 (still 0).
:    Duplicate.
```
Now the IP is at the relevant junction and moves straight ahead onto the `(` which decrements the top of the stack to `-1`. The IP hits a dead end and turns around. `:` duplicates the top of the stack once more. Now the top of the stack is negative and the IP turns left (west). We now execute one more iteration of the main loop:
```
\   Print linefeed.
!   Print top of stack (-1).
`   Multiply by -1 (1).
:   Duplicate.
```
This time, the top of the stack is positive, so IP turns right (west) and immediately executes another iteration of the main loop, which prints the `1`. Then after it is negated again, we hit the `:` with `-1` on the stack.
This time the IP turns left (east). The `"` is just a no-op and the IP turns around in the dead end. `:` makes another copy and this time the IP turns south. `(` decrements the value to `-2`, the IP turns around again. With the top of the stack *still* negative, the IP now turns west on the `:` and does the next iteration of the main loop.
In this way, the IP will now iterate between a tight loop iteration, printing a positive number, and an iteration that goes through both dead ends to decrement the value before printing a negative number.
You might ask yourself why there's the `"` on the second line if it doesn't actually do anything: without it, when the IP reaches `:` on a negative value, it *can't* turn left (east) so it would turn right (west) instead (as a rule of thumb, if the usual direction at a junction isn't available, the IP will take the opposite direction). That means the IP would also never reach the `(` at the bottom and we couldn't distinguish positive from negative iterations.
[Answer]
# JavaScript (ES5), 32 31 30 29 bytes
```
for(i=0;;)[i++,-i].map(alert)
```
Prints `0 -1 1 -2 2 -3 3 -4 4 -5 5 ...`
Saved 1 byte thanks to Patrick Roberts!
Saved 2 bytes thanks to Conor O'Brien!
[Answer]
## JavaScript, ~~29~~ 26 bytes
### Non-infinite version, 26 bytes
*Saved 3 bytes thanks to ETHproductions*
```
for(n=1;;)alert([1-n,n++])
```
will display all integers between -9007199254740991 and 9007199254740992.
### Infinite version (ES6), ~~114~~ 112 bytes
*Saved 2 bytes thanks to ETHproductions*
```
for(n=[-1];1;alert(n[a||n.unshift(1),0]?(x=n.join``)+' -'+x:0))for(i=n.length,a=0;i--;a=(n[i]+=1-a)>9?n[i]=0:1);
```
will display all integers, given infinite time and memory.
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~26~~ ~~22~~ ~~19~~ ~~16~~ 15 bytes
Prints numbers separated by newlines. -3 bytes from @manatwork. -3 bytes from @m-chrzan. -1 bytes from @CGOneHanded via upgrading to Ruby 2.7+.
```
0.step{p~_1,_1}
```
[Attempt This Online! (with a 5 ms timeout)](https://ato.pxeger.com/run?1=m72kqDSpcsFN3aLUwtLMolQF9ZLM3NT80hJ1rhAIw8oKKqJhoGdgYGCqqZCSv7S0JE3XYr2BXnFJakF1QV28oU68YS1EdHFqXgqEtWABhAYA)
[Answer]
# Java, ~~65~~ 54 bytes
```
i->{for(;;)System.out.print(i+++" "+(-i<i?-i+" ":""));
```
# Ungolfed test code
```
public static void main(String[] args) {
    Consumer<Integer> r = i -> {
        for (;;) {
            System.out.print(i++ + " " + (-i < i ? -i + " " : ""));
        }
    };
    r.accept(0);
}
```
[Answer]
**C#, 83 bytes**  
```
void f(){for(decimal n=0;;n++){Console.Write(n+",");if(n>0)Console.Write(-n+",");}}
```
Ungolfed:
```
void f()
{
  for (decimal n=0;;n++)
  {
    Console.Write(n + ",");
    if (n > 0) Console.Write(-n + ",");
   }
}
```
Outputs:
```
0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6.......
```
[Answer]
# C# ~~86~~ 66 bytes
New answer:
```
void b(){for(var i=0;;i++)Console.Write(i==0?","+i:","+i+",-"+i);}
```
Clear:
```
void b() 
{
    for(var i=0;;i++)
        Console.Write(i == 0 ? "," + i : "," + i + ",-" + i);
}
```
Old answer (86 bytes):
```
void a(){Console.Write(String.Join(",",Enumerable.Range(int.MinValue,int.MaxValue)));}
```
Ungolfed:
```
void a()
{
    Console.Write(String.Join(",", Enumerable.Range(int.MinValue, int.MaxValue)));
}
```
[Answer]
# J, 25 bytes
```
([:$:1:`-`(1+-)@.*[echo)0
```
Works on [the online site](http://tryj.tk/), but I can't verify it on computer yet. Prints numbers like:
```
0
1
_1
2
_2
3
_3
4
```
etc.
[Answer]
# Vim, 19 keystrokes
```
i0<cr>1<esc>qqYpi-<esc>p<C-a>@qq@q
```
Creates a recursive macro that duplicates a number, makes it negative, prints the original number again and increments it.
[Answer]
# [><>](https://esolangs.org/wiki/Fish), ~~19~~ 15 bytes
```
1::1$-naonao1+!
```
This prints the following:
```
0
1
-1
2
-2
3
-3
```
... and so on. The separator is a newline.
Re-written after reading @xnor's answer to use a version of that algorithm. Starting at `n=1`, the program prints `1-n` and `n`, each followed by a newline, before incrementing `n`. After overflowing the maximum value the program will end with an error of `something smells fishy...`. Exactly when this will happen depends on the interpreter implementation.
---
Previous version:
```
0:nao0$-:10{0(?$~+!
```
Starting at 0, the program loops indefinitely. On each loop, the current value is printed along with a newline. It is then negated, and incremented if positive.
]