[Question]
  [
Write a complete program that takes a boolean or non-negative integer input. It must:
* Output its own source code if the input value is falsy
* Output its own source code in reverse if the input value is truthy
Your program cannot be palindromic, nor can it read its own source code by any means.
This is code golf - shortest code in bytes wins.
  
[Answer]
## CJam, ~~17~~ 16 bytes
```
{`"_~"+Wq~g#%}_~
```
[Test it here.](http://cjam.aditsu.net/#code=%7B%60%22_~%22%2BWq~g%23%25%7D_~&input=0)
A fairly straight-forward modification of the standard quine. Other solutions for 17 bytes:
```
{`"_~"+q~{W%}&}_~
{`"_~"+q~!2*(%}_~
```
If I can assume that the input is only 0 or 1 (as a stand-in for a boolean, which there is no dedicated type for in CJam), I get 15 by omitting the `g`:
```
{`"_~"+Wq~#%}_~
```
### Explanation
```
{`"_~"+  e# Standard generalised quine framework. Leaves the source code on the stack. 
  W      e# Push a -1.
  q~     e# Read and evaluate input.
  g      e# signum, turning truthy values into 1 (leaving 0 unchanged).
  #      e# Power. -1^0 == 1, -1^1 == -1.
  %      e# Select every Nth element: a no-op for 1 and reverses the string for -1.
}_~
```
[Answer]
# [Gol><>](https://github.com/Sp3000/Golfish/wiki), 9 bytes
```
'rd3*I?rH
```
I feel a little awkward posting this, since we already have ><>, Vitsy and Minkolang answers. The only additions to the standard quine are `I` (read integer input), `?` (execute next if truthy) and `r` (reverse stack).
[Try it online](https://golfish.herokuapp.com/?code='rd3%2aI%3FrH&input=1&debug=false).
[Answer]
# Pyth, 17 bytes
```
_WQjN*2]"_WQjN*2]
```
A straightforward modification of the standard Pyth quine.
[Answer]
## ><>, 17 Bytes
Requires the -v flag (+1 byte) for pushing input onto the stack (or for you to put input on the stack beforehand on the online interpreter).
```
'rd3*$?rol?!;70.
```
You could do the below for the same amount of bytes (without the flag) if integer inputs only were allowed (i.e. 0 for falsy, 1 for truthy).
```
'rd3*ic%?rol?!;80.
```
[Try it online](http://fishlanguage.com/playground)
Truthy/falsy for ><> are anything not 0 and 0, respectively.
[Answer]
# [Vitsy](https://github.com/VTCAKAVSMoACE/Vitsy), 15 Bytes
...I'm... I'm beating CJam! (shouts over) *Mom! Look, ma, I deed it!*
```
'rd3*i86*-)rl\O
```
Explanation:
```
'rd3*i86*-(rl\O
Standard quine, but with a twist:
'               Capture the source code as a string
 rd3*           Create the ' character in ASCII
     i86*-      Get the input character as ASCII then subtract 48 from it. 
                    If it's zero, it'll the if statement will skip the next instruction.
          (r    If the top item of the stack is zero, do not do the next item.
                    The next item here is reverse.
            l\O Print out the stack.
```
## Newer Version of [Vitsy](https://github.com/VTCAKAVSMoACE/Vitsy), 11 Bytes
```
v'rd3*}v)rZ
v            Capture the input as a variable.
 '           Capture the source until encountering another '
  r          Reverse the stack.
   d3*       Push ' to the stack.
      }      Rotate the stack to the right one.
       v)    Push the variable (input) to the stack and test if it is not zero.
         r   If so, reverse the stack.
          Z  Output everything in the stack.
```
[Answer]
## Python 2, 51 bytes
```
s="print('s=%r;exec s'%s)[::1-2*0**input()]";exec s
```
[Answer]
# Javascript (ES6), 42 bytes
```
$=_=>'$='+(_?$:[...''+$].reverse().join``)
```
This is a modification of my [Bling Quine](https://codegolf.stackexchange.com/questions/69/golf-you-a-quine-for-great-good/60148#60148). It's twice as long, too.
[Answer]
## Burlesque, 40 bytes
```
ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh
```
**Explanation:**
Burlesque has advanced stack and code manipulation built-ins. In fact, you can't access the source code of the program but you can access the remaining 
code that is to be executed in the future. This means `#Q` will return all the code that follows it which is why we have to add everything up to `#Q` to that code which is what we're doing with `ri#Q`. 
```
blsq ) #Q1 2++
12 -- this is the result of 1 2++
{1 2 ++} -- this is the result of #Q
```
`++1 2` is technically illegal code since it's stack based. But we can manipulate the code to make it execute as `1 2++`:
```
blsq ) #Q<-#q++1 2 
12
```
Working with these built-ins is incredibly tricky and nobody has yet used them for anything productive except for quine related things. If you reverse `++1 2` you get `2 1++` which would produce `21` and not `12`. The reason the code above produces `12` is because `#Q` also includes the `<-` so in the end we end up executing a lot more than just `2 1++` :p. We end up executing `2 1++#q<-` which produces `12`.
We can actually replace things in our code for example this code replaces all occurences of `?+` in itself with `?*`
```
blsq ) #Q(?+)(?*)r~5.-#q5 5?+
25
```
**Usage:**
```
$ echo "1" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh'
hs fi sp "-<" j +. /\ "Q#ir" -~ HS 2Q#ir
$ echo "0" | blsq --stdin 'ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh'
ri#Q2 SH ~- "ri#Q" \/ .+ j "<-" ps if sh
```
[Answer]
## Haskell, ~~126~~ ~~118~~ 108 bytes
```
main=readLn>>=putStr.([t,reverse t]!!);t=s++show s;s="main=readLn>>=putStr.([t,reverse t]!!);t=s++show s;s="
```
Expects `0` or `1` as input.
[Answer]
## [Minkolang 0.10](http://play.starmaninnovations.com/minkolang/?code=%2266*2-n%3Fr%24O%2E&input=1), 13 bytes
```
"66*2-n,?r$O.
```
[Try it here.](http://play.starmaninnovations.com/minkolang/?code=%2266*2-n%2C%3Fr%24O%2E&input=1)
This is exactly like the standard quine except for these four characters: `n,?r`. `n` takes an integer from input, `,` inverts it, so `?` skips `r` if the input is truthy. Otherwise, `r` reverses the stack so that it is output in reverse order.
[Answer]
# Java 10 (full program), 282 bytes
```
interface N{static void main(String[]a){var s="interface N{static void main(String[]a){var s=%c%s%1$c;s=s.format(s,34,s);System.out.print(new Boolean(a[0])?new StringBuffer(s).reverse():s);}}";s=s.format(s,34,s);System.out.print(new Boolean(a[0])?new StringBuffer(s).reverse():s);}}
```
[Try it online.](https://tio.run/##tcxBCsIwEIXhq4RiIYEaFF1ZitADuOmydDG0E0m1iWSmFSk9e6x4AhduH//7ephg23e3GK1jDAZaFJeZGNi2YvK2EwNYJysO1l3rBtQ8QRBUJL/laZtSut@0ORWkjQ8DsKTscMxI5dWLGAftR9aP9cbS4VOU3t8RnIR616jzZ/ma5WgMBklKB5wwEEp1Wo1lSf5Hxxg5jPgG)
# Java 10 (as lambda function), 154 bytes
```
b->{var s="b->{var s=%c%s%1$c;s=s.format(s,34,s);return b?new StringBuffer(s).reverse():s;}";s=s.format(s,34,s);return b?new StringBuffer(s).reverse():s;}
```
[Try it online.](https://tio.run/##pY9BS8NAEIXv@RVDMbAL7YLoyRAF79ZDj@Jhsp2UjclumZlEpOS3x60tePLkZZjhvTe8r8MJN93@Y/E9isALhngqAEJU4hY9wfZ8Arw2HXkFb5qUesIIja2yMBd5iKIGD1uIUMPSbB5PEzJIvfpdS19KeXvjK6nFtYkHVCPru/u12IpJR84PnyJ9wk45xMPz2LbERqxjmoiFjH2Qal79L75U57bHselz22vpKYU9DJnaXKJv74D2grz7EqXBpVHdMUvaRxOdNy32QvaH/k@P8ni1zMW8fAM)
**Explanation:**
```
interface N{                          // Class
  static void main(String[]a){        //  Mandatory main-method
    var s="interface N{static void main(String[]a){var s=%c%s%1$c;s=s.format(s,34,s);System.out.print(new Boolean(a[0])?new StringBuffer(s).reverse():s);}}";
                                      //   Unformatted source code
    s=s.format(s,34,s);               //   Format the source code (the quine-String)
    System.out.print(                 //   Print:
      new Boolean(a[0])?              //    If the input is true:
       new StringBuffer(s).reverse()  //     Print the quine-String reversed
      :                               //    Else:
       s);}}                          //     Print the quine-String as is
```
**[quine](/questions/tagged/quine "show questions tagged 'quine'") explanation:**
* The `var s` contains the unformatted source code
* `%s` is used to put this String into itself with `s.format(...)`
* `%c`, `%1$c`, and `34` are used to format the double-quotes
* `s.format(s,34,s)` puts it all together
And then `new StringBuffer(s).reverse()` is used to reverse the quine-String if necessary based on the input-boolean.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 21 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
0"D34çýÂ‚sè"D34çýÂ‚sè
```
[Try it online.](https://tio.run/##yy9OTMpM/f/fQMnF2OTw8sN7Dzc9aphVfHgFOv//f0MA)
Modification of the default [quine](/questions/tagged/quine "show questions tagged 'quine'") [`0"D34çý"D34çý`](https://codegolf.stackexchange.com/a/97899/52210) by adding `Â‚sè`.
**Explanation:**
```
0                        # Push 0 to the stack
                         #  STACK: [0]
 "D34çýÂ‚sè"             # Push the string 'D34çýÂ‚sè' to the stack
                         #  STACK: [0, 'D34çýÂ‚sè']
            D            # Duplicate this string
                         #  STACK: [0, 'D34çýÂ‚sè', 'D34çýÂ‚sè']
             34ç         # Push '"' to the stack
                         #  STACK: [0, 'D34çýÂ‚sè', 'D34çýÂ‚sè', '"']
                ý        # Join the stack with '"' delimiter
                         #  STACK: ['0"D34çýÂ‚sè"D34çýÂ‚sè']
                 Â       # Bifurcate (short for Duplicate & Reverse)
                         #  STACK: ['0"D34çýÂ‚sè"D34çýÂ‚sè', 'ès‚Âýç43D"ès‚Âýç43D"0']
                  ‚      # Pair them up:
                         #  STACK: [['0"D34çýÂ‚sè"D34çýÂ‚sè','ès‚Âýç43D"ès‚Âýç43D"0']]
                   s     # Swap to get the boolean input (0 or 1)
                         #  STACK: [['0"D34çýÂ‚sè"D34çýÂ‚sè','ès‚Âýç43D"ès‚Âýç43D"0'], 1]
                    è    # Index the input into the list
                         #  STACK: ['ès‚Âýç43D"ès‚Âýç43D"0']
                         # (Output the top of the stack implicitly)
```
PS: Automatically prints a trailing newline. If this should be reversed as well, it's 23 bytes instead:
```
0"D34çýÂ‚sè?"D34çýÂ‚sè?
```
[Try it online.](https://tio.run/##yy9OTMpM/f/fQMnF2OTw8sN7Dzc9aphVfHiFPYbA//@GAA) (`?` is an explicit *Print without new-line*)
]