[Question]
  [
Your task, if you wish to accept it, is to write a program that outputs a non-zero number(can be integer or float). The tricky part is that if I reverse your source code, the output must be the original integer negated.
# Rules
* You must build a **full program**. That is, your output has to be printed to STDOUT.
* Both the numbers must be in base 10 (outputting them in any other base or with scientific notation is forbidden).
* Outputting the numbers with trailing / leading spaces is allowed.
* This is code-golf, so the shortest (original) code in each language wins!
* Default Loopholes apply.
## Example
Let's say your source code is `ABC` and its corresponding output is `4`. If I write `CBA` instead and run it, the output must be `-4`.
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
```
(1
```
[Try it online!](https://tio.run/##yy9OTMpM/f9fw/D/fwA "05AB1E – Try It Online")
[!enilno ti yrT](https://tio.run/##yy9OTMpM/f/fUOP/fwA "05AB1E – Try It Online")
```
(       # negate nothing
 1      # push 1 (and implictly output it)
```
```
1       # push 1
 (      # negate it (and implictly output it)
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~4~~ 3 bytes
```
1-0
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfn/31DX4P9/AA "PowerShell – Try It Online") or [!enilno ti yrT](https://tio.run/##K8gvTy0qzkjNyfn/30DX8P9/AA "PowerShell – Try It Online")
*Golfed a byte by using arithmetic instead of the number-comment-number format.*
---
This is apparently also the same as jshell (per [Sam](https://codegolf.stackexchange.com/users/89348/sam)), and jq (per [manatwork](https://codegolf.stackexchange.com/users/4198/manatwork) -- [`1-0`](https://tio.run/##yyr8/99Q1@D//3/5BSWZ@XnF/3XzAA) and [`0-1`](https://tio.run/##yyr8/99A1/D//3/5BSWZ@XnF/3XzAA)).
[Answer]
# [JavaScript (V8)](https://v8.dev/), 19 bytes
```
print(1)//)1-(tnirp
```
[Try it online!](https://tio.run/##TYxNCsMgEIX3niK7zECd4K5QcpJSiJihGMQRFa9vGqi0u/fzvXfYZovLPlXd7t3JzuvWU/axgsFlQaOhRp9T36gE7xjMTRtUKnPjXHif1ulJRNfwRd8QkA7xEeYZH0o5iUUCU5A3XNgn42bD0P/1OB3Iz/cT "JavaScript (V8) – Try It Online")
---
almost identical to...
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 19 bytes
```
Print(1)//)1-(tnirP
```
[Try it online!](https://tio.run/##Sy7WTS7O/P8/oCgzr0TDUFNfX9NQV6MkL7Mo4P9/AA "C# (Visual C# Interactive Compiler) – Try It Online")
*(thanks to @someone for pointing it out)*
---
still pretty much the same in...
# [Lua](https://www.lua.org/), 19 bytes
```
print(1)--)1-(tnirp
```
[Try it online!](https://tio.run/##yylN/J@cn5JqqxEd/b@gKDOvRMNQU1dX01BXoyQvs6jgf2ysplVxaZKGoY6ukSYXV1FqWWpRcWqKgq0CSJsVlK8BlILoBolqcuXkJ6ZAmEAZiARMJ1QSztXQ/A8A "Lua – Try It Online")
---
but shorter in...
# [Python 2](https://docs.python.org/2/), 15 bytes
```
print 1#1-tnirp
```
[Try it online!](https://tio.run/##K6gsycjPM/r/v6AoM69EwVDZULckL7Oo4P9/AA "Python 2 – Try It Online")
---
Even shorter in PHP, because it has this magic printing tool: `<?=` ...
# [PHP](https://php.net/), 12 bytes
```
<?=1;#;1-=?<
```
[Try it online!](https://tio.run/##K8go@P/fxt7W0FrZ2lDX1t7m/38A "PHP – Try It Online")
---
Even shorterer in Ruby, because you can `inspect` rather than print
# [Ruby](https://www.ruby-lang.org/), 8 bytes
```
p 1#1- p
```
[Try it online!](https://tio.run/##KypNqvz/v0DBUNlQV6Hg/38A "Ruby – Try It Online")
[Answer]
# [///](https://esolangs.org/wiki////), 4 bytes
```
9/9-
```
Outputs `9`.
[Try it online!](https://tio.run/##K85JLM5ILf7/31LfUvf/fwA "/// – Try It Online")
Reversed:
```
-9/9
```
Outputs `-9`.
[Try it online!](https://tio.run/##K85JLM5ILf7/X9dS3/L/fwA "/// – Try It Online")
Everything before the `/` is printed, while the rest is ignored (not really used slashes much so I don't know exactly what happens, but it doesn't output anything).
[Answer]
# [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php), 21 bytes
```
S S S T N
T   N
S T N
N
N
T   S N
T   N
T   T   S S 
```
Letters `S` (space), `T` (tab), and `N` (new-line) added as highlighting only.
Outputs `1`/`-1`.
[Try it online](https://tio.run/##K8/ILEktLkhMTv3/X0FBgZOLkwtIcHFxKgBZnJwKCv//AwA) or [try it online reversed](https://tio.run/##K8/ILEktLkhMTv3/X0GBk5OLk0uBk4uLi1MByOJUUFD4/x8A) (with raw spaces, tabs and new-lines only).
**Explanation:**
Utilizing the *Exit Program* builtin being a short palindrome `NNN`.  
The regular program will:
```
SSSTN  # Push 1 to the stack
TNST   # Pop and print the top of the stack as number
NNN    # Exit the program, making everything after it no-ops
```
The reverse program will:
```
SSTTN  # Push -1 to the stack
TNST   # Pop and print the top of the stack as number
NNN    # Exit the program, making everything after it no-ops
```
Small additional explanation of pushing a number:
* First `S`: Enable Stack Manipulation
* Second `S`: Push a number to the stack
* `S` or `T`: Positive/negative respectively
* Some `S`/`T` followed by a trailing `N`: number in binary, where `S=0` and `T=1`
I.e. `SSTTSTSN` pushes `-10`.
[Answer]
## [Stack Cats](https://github.com/m-ender/stackcats) `-mn`, 4 bytes
```
:-:_
```
[Try it online!](https://tio.run/##FcshDgAhDERRzy1qm/QCvUE9jrANQW4WA5K7d6fm5Y@YfcZ85zg7QkU9iF0LS0s68CzPagI6cGLABG5SQX6LXgE1MUx7TCPkWz8 "Stack Cats – Try It Online") In the footer I've included all other 4-byte solutions. (Stack Cats ignores everything after the first linefeed.)
[Try the reverse!](https://tio.run/##Ky5JTM5OTiwp/v8/3krX6v///7q5eQA "Stack Cats – Try It Online")
### Explanation
The `-n` flag turns on numeric output (and input, but we don't have any), and the `-m` flag is normally just a golfing convenience which lets you avoid the redundant part of the source code. This is because every Stack Cats program needs to have mirror symmetry. With the `-m` flag you only give it the first half (plus the central character). So the *actual* program here is:
```
:-:_:-:
```
As you can see in the first TIO link, there's a ton of 4-byte solutions, but I picked this one for its simplicity. Stack Cats is stack-based, and this program only uses the initial stack. Since we don't have any input, it contains a single `-1` (an EOF marker) on top of an infinite well of zeros. The three commands in the program have the following meaning:
```
:   Swap the top two stack elements.
-   Negate the top stack element (i.e. multiply by -1).
_   Pop a. Peek b. Push b-a.
```
So here is how the program modifies the stack (states and commands are staggered to indicate how each command changes the stack from one state to the next):
```
   :   -   :   _   :   -   :
-1   0   0  -1   1   0   0   1
 0  -1  -1   0   0   1   1   0
 0   0   0   0   0   0   0   0
 …   …   …   …   …   …   …   …
```
As it turns out, the only command that really does anything here is `_` which turns our EOF marker into a `1`. Output at the end of the program is implicit, and the EOF marker is optional, so this just prints out the `1` we get.
Now if we reverse the source code, due to the implicit mirroring, the actual program becomes:
```
_:-:-:_
```
This does something very different:
```
   _   :   -   :   -   :   _
-1   1   0   0   1  -1   0  -1
 0   0   1   1   0   0  -1  -1
 0   0   0   0   0   0   0   0
 …   …   …   …   …   …   …   …
```
This time the bottom of the stack *is* still a `-1` so it does act as the EOF marker and only the `-1` on top of it gets printed.
...
Now with all of that said, since Stack Cats has such a unique relationship with reversing code, I feel that using `-m` is a little cheating. It's normally only meant to save bytes by omitting the redundant part of the source code, but here it actually makes the challenge a lot easier and even the full program shorter. This is because reversing a full program will only change the program if it contains any of `<>[]`, which also means that the program ends up making use of multiple stacks (Stack Cats actually has a tape of stacks, where all but the initial one are only filled with zeros to begin with). Furthermore, reversing it then just swaps the `<>` and `[]` pairs, which still makes the execution symmetric. The only way to break that symmetry is to use `I` which does `-]` or `-[` or nothing depending on the sign of the top of the stack. So...
---
## [Stack Cats](https://github.com/m-ender/stackcats) `-n`, 11 bytes
```
*|]I*:*I[|*
```
[Try it online!](https://tio.run/##TdG7jgMhDAXQfr8i0zoaRbslQtPf3h0BFKVcKU1S8u@zNr5IW8BwwDaPeX8ez9/n4/M@TxkVkgRlyLmPLAesjf3y/bWPgp46KoViqggpIzXESIqRIS8HL7ykUOrf3pcfE6SmIliqtlYoZaSGGLkUkaFD0K8dksV26C1vds7taN3lA/jUEjqWDslIsN7VOvN6c/kAM9uUtlTsRtW@lN2ImhmY2RQiMdQMjbInsCr@IJRVofwQdhY/kqmMY8uwNqpLKZ3yaXjAklWh7Ff5DawvUzqlUxj3qduASymdqswrIeaF7ly7hbjmOs/99Qc "Stack Cats – Try It Online") The footer again includes all other alternatives at the same byte count. Some of those output 1/-1 and some output 2/-2 as indicated after each program. I picked this one to explain kinda randomly as one of the ones that output 2.
[Try the reverse!](https://tio.run/##Ky5JTM5OTiwp/v9fqybaU8tKyzO2Ruv///@6eQA "Stack Cats – Try It Online")
### Explanation
As I said, this one's a bit longer. Even if we did use the `-m` notation for this, it would weigh in at 6 bytes instead of the above 4.
The commands in use this time:
```
*   Toggle the least significant bit of the top of the stack.
|   Reverse the longest non-zero of prefix on this stack.
[]  Move one stack to the left/right and take the top of the current stack with you.
I   If the top of the stack is positive, -], if it's negative, -[, otherwise do nothing.
:   Swap the top two stack elements.
```
The first program only uses two stacks. That's a bit messy to do in ASCII art, but I'll try my best. The square brackets indicate which stack the tape head is on, and I'll put the commands between each pair of stack states.
```
  [-1]
…   0   0   …
    0   0
    …   …
      *
  [-2]
…   0   0   …
    0   0
    …   …
      | (does nothing)
      ]
      [-2]
…   0   0   …
    0   0
    …   …
      I
   [2]
…   0   0   …
    0   0
    …   …
      *
   [3]
…   0   0   …
    0   0
    …   …
      :
   [0]
…   3   0   …
    0   0
    …   …
      *
   [1]
…   3   0   …
    0   0
    …   …
      I
      [-1]
…   3   0   …
    0   0
    …   …
      [
  [-1]
…   3   0   …
    0   0
    …   …
      |
  [ 3]
…  -1   0   …
    0   0
    …   …
      *
  [ 2]
…  -1   0   …
    0   0
    …   …
```
Now the `-1` acts as an EOF marker and the `2` gets printed.
The other program is the same until the `[`. It's still virtually the same all the way until the second `I`. We'll technically be on a different stack, but without values on them, they're all indistinguishable. But then the difference between `I[` and `I]` ends up mattering:
```
    *|[I*:*I
      [-1]
…   3   0   0   …
    0   0   0
    …   …   …
        ]
          [-1]
…   3   0   0   …
    0   0   0
    …   …   …
        | (does nothing)
        *
          [-2]
…   3   0   0   …
    0   0   0
    …   …   …
```
And this time, we don't have an EOF marker, but the program still outputs the `-2`.
[Answer]
# [Google](https://www.google.com), 3 bytes
```
2-1
```
[Try it online!](https://www.google.com/search?q=2-1)  
[!enilno ti yrT](https://www.google.com/search?q=1-2)
[Answer]
# [Klein](https://github.com/Wheatwizard/Klein) 011, 5 bytes
```
1-
@/
```
[Try it online!](https://tio.run/##y85Jzcz7/99Ql8tB/////waGhgA "Klein – Try It Online")
# Reversed
```
/@
-1
```
[Try it online!](https://tio.run/##y85Jzcz7/1/fgUvX8P///waGhgA "Klein – Try It Online")
These take advantage of Klein's unique topology, specifically the real projective plane. (Although individually each answer only needs a Klein bottle).
[Answer]
# [Haskell](https://www.haskell.org/) without comments, 41 bytes
Forwards prints `1` + newline:
```
main=print$!1
niam=main
"1-"!$rtStup=niam
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/PzcxM8@2oCgzr0RF0ZArLzMx1xYkxKVkqKukqFJUElxSWmALEv7/HwA "Haskell – Try It Online")
Reversed prints `-1` with no newline (which could be added at a cost of 2 bytes):
```
main=putStr$!"-1"
niam=main
1!$tnirp=niam
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/PzcxM8@2oLQkuKRIRVFJ11CJKy8zMdcWJMxlqKhSkpdZVGALEvr/HwA "Haskell – Try It Online")
* The first line of each program prints the number.
	+ For `-1` string output is used to avoid parentheses.
	+ Using `$!` (strict application) instead of a space allows the reversed line to be a valid definition of the operator `!$` (just `$` wouldn't do since the redefinition would break the use).
* The middle line ensures that `niam` is defined for the last line.
* The last line is a definition of an operator `!$`, which is not used but needs to parse and typecheck correctly.
[Answer]
# [PHP](https://php.net/), ~~15~~ 13 bytes
A PHP version without comment abuse. `ohce` is an undefined constant, so it will be equal to string value of its name. As a result, this will try to print `+1-'ohce'` or `-1+'ohce'` when reversed. Since `'ohce'` is a non-numeric value, 0 will be used instead in the arithmetic operations and only `1` or `-1` will be printed.
```
;echo+1-ohce;
```
[Try it online!](https://tio.run/##K8go@G9jXwAkrVOTM/K1DXXzM5JTrf//BwA "PHP – Try It Online")
[‮Try it online!](https://tio.run/##K8go@G9jXwAkrVOTM/J1DbXzM5JTrf//BwA "PHP – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 2 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Any single digit integer `>0` can be used in place of the `2` as can `A-G`, `H`, `I`, `J` or `L` (`10-16`, `32`, `64`, `-1` & `100`, respectively).
```
n2
```
[Test it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=bjI) | [Reversed](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=Mm4)
The `n` method when applied to an integer, subtracts that integer from the argument passed to it, which defaults to `0`. When run forwards, the `n` method is being run on the implicit first input, which also defaults to `0`.
Alternatively, the `g` method could be used instead of `n`, which gives the sign of the result of subtracting its argument from the integer it's applied to.
[Answer]
# [Cubix](https://github.com/ETHproductions/cubix), ~~7~~ ~~6~~ 5 bytes
```
@)O(@
```
[Try it here](https://ethproductions.github.io/cubix/?code=QClPKEA=&input=&speed=3)  
[Reversed](https://ethproductions.github.io/cubix/?code=QChPKUA=&input=&speed=3)
### Explanation
Cubified:
```
  @
) O ( @
  .
```
Unrolling the control flow, we execute `)O(@`, which increments, outputs, decrements, and exits.
Reversed and cubified:
```
  @
( O ) @
  .
```
Unrolling the control flow, we execute `(O)@`, which decrements, outputs, increments, and exits.
### Previous version
```
@O(.)O@
```
[Try it here](https://ethproductions.github.io/cubix/?code=ICAgIEAgTwogICAgKCAuCikgTyBAIC4gLiAuIC4gLgouIC4gLiAuIC4gLiAuIC4KICAgIC4gLgogICAgLiAuCg==&input=&speed=3)  
[Reversed](https://ethproductions.github.io/cubix/?code=ICAgIEAgTwogICAgKSAuCiggTyBAIC4gLiAuIC4gLgouIC4gLiAuIC4gLiAuIC4KICAgIC4gLgogICAgLiAuCg==&input=&speed=3)
Not as short, but aesthetically pleasing.
[Answer]
# T-SQL, 16 bytes
```
--Forwards:
PRINT 4--4-TNIRP
--Backwards:
PRINT-4--4 TNIRP
```
Picked 4 because 1 is overused :)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes
```
NC
```
[Try it online!](https://tio.run/##y0rNyan8/9/P@f9/AA "Jelly – Try It Online")
`N`egative, results in `0`, then `C`omplement, results in `1-0` = `1`.
---
```
CN
```
[Try it online!](https://tio.run/##y0rNyan8/9/Z7/9/AA "Jelly – Try It Online")
`C`omplement, results in `1-0` = `1`. `N`egative, results in `-1`.
[Answer]
# [K (ngn/k)](https://gitlab.com/n9n/k), 3 bytes
```
2-1
```
[Try it online!](https://tio.run/##y9bNS8/7/99I1/D/fwA "K (ngn/k) – Try It Online")
am i missing something? seems obvious for REPL languages 
[Answer]
# [Hexagony](https://github.com/m-ender/hexagony), 5 bytes
```
1!@!(
```
[Try it online!](https://tio.run/##y0itSEzPz6v8/99Q0UFR4/9/AA "Hexagony – Try It Online")
Any valid program must:
* Have a termination command (`@` or `:`). The latter is only different for the former when there's a memory pointer movement command. Also this command must not be at the first or the last byte.
* Have an output command. (`!`, `;` is also possible but would probably take more bytes)
* Have a memory manipulation command.
Therefore a 2-byte program is obviously impossible. A 3-byte program is impossible because the second byte must be the termination command, and the first byte must not be a mirror/IP manipulation command, therefore only 1 byte can be executed.
I think a 4-byte program is not possible. Such a program must have the form `a@bc` with hexagonal grid
```
 Forward:       | Backward:
                | 
  c b           |   a @
 @ a .          |  b c .
  . .           |   . .
```
Therefore `a` must be a IP redirection command. However it's impossible to generate both positive and negative number with only 1 memory manipulation command.
[Answer]
# [Runic Enchantments](https://github.com/Draco18s/RunicEnchantments/tree/Console), 4 bytes
```
1@Z1
```
[Try it online!](https://tio.run/##KyrNy0z@/9/QIcrw/38A "Runic Enchantments – Try It Online") [Try it Reversed!](https://tio.run/##KyrNy0z@/98wysHw/38A "Runic Enchantments – Try It Online")
I couldn't find a way to re-use the `1` command, even at the expense of a byte or two.
[`1@ɩ`](https://tio.run/##KyrNy0z@/9/Q4eTK//8B) also works, but is the same number of bytes.
[Answer]
# [Zsh](https://www.zsh.org/), 12 bytes
```
<<<2 # 2-<<<
```
[Try it online!](https://tio.run/##qyrO@P/fxsbGSEFZwUgXyABxdME8EAcA "Zsh – Try It Online")
Basic forward, comment, reverse method.
---
If I/O is less restrictive, then a more interesting **11 byte** solution is possible thanks to Zsh supporting negative return codes:
```
return -127
```
Reversed, `721- nruter` exits with code `127` (command not found). `exit -127` cannot be used, it would be cast to a `u8`.
[Try it online!](https://tio.run/##qyrO@J@moVn9vyi1pLQoT0HX0Mj8fy1XEVCIy9zIUFchr6i0JLWIq5aLK40rNTkjX0HFnourCMb8DwA "Zsh – Try It Online")
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), ~~4~~ 3 bytes
```
1-0
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R2wRDXQOudCBtoGsIFOBKBwA "APL (Dyalog Unicode) – Try It Online")
Trivial answer. Prints `1` when run and `¯1` when run reversed.
[Answer]
# [CJam](https://sourceforge.net/p/cjam), 3 bytes
```
W;1
```
Try it online!
* [Normal](https://tio.run/##S85KzP3/P9za8P9/AA)
* [Reversed](https://tio.run/##S85KzP3/39A6/P9/AA)
### How they work
Normal version:
```
W    e# Push -1
;    e# Delete
1    e# Push 1
     e# Implicit display
```
Reverse version: you get the idea.
[Answer]
# [MATL](https://github.com/lmendo/MATL), 3 bytes
```
Nqv
```
Try it online!
* [Normal](https://tio.run/##y00syfn/36@w7P9/AA)
* [Reversed](https://tio.run/##y00syfn/v6zQ7/9/AA)
### How they work
Normal:
```
N   % Push number of elements in the stack: 0
q   % Subtract 1: gives -1
v   % Concatenate stack contents vertically: leaves -1 as is
    % Implicit display stack contents
```
Reversed:
```
v   % Concatenate stack contents vertically: gives the empty array, []
q   % Subtract 1: leaves [] as is
N   % Push number of elements in the stack: 1
    % Implicit display. [] is not displayed
```
[Answer]
# [Perl 5](https://www.perl.org/) (-p), 12 bytes
```
\$--{}}{++$\
```
[Try it online!](https://tio.run/##K0gtyjH9/z9GRVe3ura2WltbJeb//3/5BSWZ@XnF/3ULAA "Perl 5 – Try It Online")
[!enilno ti yrT](https://tio.run/##K0gtyjH9/z9GRVu7ura2WldXJeb//3/5BSWZ@XnF/3ULAA)
The `}{` pseudo-operator really comes in handy.
---
## [Perl 5](https://www.perl.org/) (-M5.010), 9 bytes
*Provided by Nahuel Fouilleul in a comment*
```
say+1-yas
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVLbULcysfj//3/5BSWZ@XnF/3V9TfUMDA0A "Perl 5 – Try It Online")
[!enilno ti yrT](https://tio.run/##K0gtyjH9/784sVLXULsysfj//3/5BSWZ@XnF/3V9TfUMDA0A "Perl 5 – Try It Online")
[Answer]
## [Retina](https://github.com/m-ender/retina/wiki/The-Language), 6 bytes
```
-`<
-
```
Prints `1`.
[Try it online!](https://tio.run/##K0otycxLNPz/XzfBhkuX6/9/AA "Retina – Try It Online")
---
```
-
<`-
```
Prints `-1`.
[Try it online!](https://tio.run/##K0otycxLNPz/n0uXyyZB9/9/AA "Retina – Try It Online")
### Explanation: `1`
```
-`<
-
```
This... does nothing. Due to the ```, this is a substitution from `<` to `-` (with configuration `-`, which does nothing), but the input is empty, so the output is empty as well.
```
```
And this second stage matches the empty regex against the empty input and counts the number of matches, which is exactly 1. Output is implicit.
### Explanation: `-1`
```
-
```
This time we replace the empty regex with `-`. This does indeed turn the empty input into a single `-`.
```
<`-
```
Here, the configuration actually does something: `<` prints the stage's input before executing the stage, so we print the `-`. Then `-` counts the hyphens in the stage's input which is again 1. Due to the implicit output, this prints a `1` after the `-`, giving us `-1` as required.
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~21~~ 18 bytes
```
Print@1;tnirP//1-0
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78r/Q/oCgzr8TB0LokL7MoQF/fUNfgv5K@vgaXQki@a0VBUWpxcWZ@noOyNZpAcAlQX3pQallqUXGqgzKXptp/AA "Wolfram Language (Mathematica) – Try It Online")
-3 thanks to [Martin Ender](https://codegolf.stackexchange.com/questions/192979/i-reverse-the-source-code-you-negate-the-output/193040?noredirect=1#comment460420_193040)
[Answer]
# [brainfuck](https://github.com/TryItOnline/brainfuck), 156 bytes
```
+++++++++++++++++++++++++++++++++++++++++++++.+++++++++++++++++++++++++++++++++++++++++++++++++<+++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fmxSgp00qsCFZB5Id//8DAA "brainfuck – Try It Online") / [Forward/backward verifier in Bash](https://tio.run/##nY@7DoMwDEV3f4WHSh4qmm5IVdqhQ38CEMoLgaABhQCfn0YdStWhLw@WdeVzfS3FWIegNDJ/HcA7TDRSbpGQcyTTV4QnFLB9qQ8C7H4l7gLw/7DnaxAzA8CiMFExuBI@dqPqHmAwrsNk2KdpapA25dGZ2bjR4KYkFPFPGXdcY32FdOndIpw@YJZlBKwfPJNONLaaVLtOkeLItJmZnbruARdFkVtazc5Ctd@4yTduIdwA "Bash – Try It Online")
Prints `-1` forward and `\n1` backwards.
Despite being almost trivial, I believe this is the optimal solution for this particular fixed output.
Proof:
* The program cannot have `[` or `]`.
Therefore the program must have the form `<A> . <B> . <C>`.
* Each `,` can be replaced with a sufficient number of `<` without increasing the number of `+` or `-`.
* Each `+` is only useful in either the forward or the backward program, never both.
Proof: `+` in part A is obviously only useful in the forward program, and `+` in part C is obviously only useful in the backward program.
Denote `shift(P)` = number of `<` in P - number of `>` in P. Consider program `<B> = <D> + <E>`, the `+` in the middle is useful in the forward program \$\iff\$ `shift(E) = 0`, similarly it's useful in the backward program \$\iff\$ `shift(D) = 0`. However if `shift(D) = shift(E) = 0` then the program `B` executed either forward or backward would add a fixed value to the current cell before printing the second time, which can't be the case because `ord('1') - ord('\n') != ord('1') - ord('-')`.
Therefore the program needs at least `ord('-')+ord('1')+ord('\n')+ord('1') = 153` `+`s, 2 `.`s, and at least a `<` `>` or `,` because `shift(B) != 0`.
[Answer]
# Google Sheets, 12
Fun problem!
Forward:
```
=1+N("(N+1-=
```
Backward:
```
=-1+N("(N+1=
```
Google sheets auto-closes quotes and parens. `N(string)` is always 0.
[Answer]
# [Haskell](https://www.haskell.org/), 28 bytes
```
main=print 1--)1-(tnirp=niam
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/PzcxM8@2oCgzr0TBUFdX01BXoyQvs6jANi8zMff/fwA "Haskell – Try It Online")
[Try it enilno!](https://tio.run/##y0gszk7Nyfn/PzcxM8@2oCgzr0RD11BTV9dQoSQvs6jANi8zMff/fwA "Haskell – Try It Online")
[Answer]
# [Triangular](https://github.com/aaronryank/triangular), 4 bytes
```
i%%d
```
[Try it online!](https://tio.run/##KynKTMxLL81JLPr/P1NVNeX/fwA "Triangular – Try It Online")
Outputs 1.
Ungolfed:
```
   i
  % %
 d
```
**Reversed:**
```
d%%i
```
[Try it online!](https://tio.run/##KynKTMxLL81JLPr/P0VVNfP/fwA "Triangular – Try It Online")
Outputs -1.
[Answer]
# Java 5 or 6, ~~127~~ 67 bytes
```
enum A{A;{System.out.print(9);}}//}};)9-(tnirp.tuo.metsyS{;A{A mune
```
Outputs `9`/`-9`.
No online compiler, because Java 5 or 6 isn't available anywhere.
You can however try this **127 bytes** Java 8 equivalent:  
[Try it online](https://tio.run/##Dc3BCoUgEEDRX5mlLrJ19A9tXEaLQS2mhxo6CSF@u8/tgcu9seB021/vFNilE42DrWZGJgMlkgWPFITmROHaD5RVf5mdV/Fl9Qxksci1tXlubZXLJDhQehS/UXnH@dNV4rFfA1mLQOjBUixgaBxy3cAZPJMbUe9/) or [try it online reversed](https://tio.run/##Dc3BCoUgEEDRX5mlLrJ19A9tXEaLQS2mhxo6CSF@u8/tgcu9seB021/vFNilE42DrWZGJgMlkgWPFITmROHaD5RVf5mdV/Fl9QxkMS1ybW2eW1vlIjhQehS/UXnH@dNV4rFfA1mLQOjBUixgaBxy3cAZPJMbUe9/).
**Explanation:**
```
enum A{                              // Create an enum
 A;                                  //  With a mandatory value
 {                                   //  And in a separate instance code-block:
  System.out.print(9);}}             //   Print 9 to STDOUT
//}};)9-(tnirp.tuo.metsyS{;A{A mune  // Comment and thus a no-op
```
Java 5 and 6 had a bug allowing you to create a code block inside an enum to do something, despite missing a program's mandatory main-method. This will result in an error:
> 
> java.lang.NoSuchMethodError: main  
> 
> Exception in thread "main"
> 
> 
> 
But will still output what we'd want to STDOUT first, so [we can ignore that](https://codegolf.meta.stackexchange.com/a/12503/52210).
[Answer]
# JavaScript, 31 bytes
The obligatory comment abuse for JavaScript!
```
console.log(1)//)1-(gol.elosnoc
```
and reversed:
```
console.log(-1)//)1(gol.elosnoc
```
]