[Question]
  [
Your task is to write a program, function, or snippet that will output one value if run forward, and another if run backward. The program must run without errors.
The output can be any two distinct values, of the same data type. For example, `1` and `3`, `true` and `false`, or `'t'` and `'f'`. In languages without a concept of data types, such as brainf\*\*\* or text, any distinct values are allowed.
This is a code golf challenge, shortest answer per language wins. Note that snippets *are* allowed (so something like `1-2` is valid, but don't expect any upvotes).
  
[Answer]
# Python 3, no comments or string literals, 106 bytes
```
x=quit
y=x.__class__
y.__add__=print
y.__pos__=x
x+x++x+x
x=__sop__.y
tnirp=__dda__.y
__ssalc__.x=y
tixe=x
```
I've never liked how comments and string literals let you "turn off" most of your language's syntax in challenges like this, so I wanted to see how far I could golf things without using either comments or string literals. This is what I came up with.
Since I don't have any way to disable the syntactical significance of parentheses, I cannot use the function call operator. Any attempt to do so would result in the reversed code having a closing parenthesis before the first opening parenthesis, which is invalid outside a comment or string literal. I also can't use `def` or container literals (aside from unparenthesized tuples), and my access to language features is in general extremely restricted.
One thing I *can* do is take advantage of Python's operator overloading to call functions implicitly. My ability to define any classes or functions is extremely limited, but fortunately, there are enough tools lying around in the built-in namespace for me to use. Most built-ins don't let me perform the attribute assignment I need to redefine their operator overloads, but (unless Python is run with one of the flags that disables `site` importing) the auto-imported `site` module adds `quit` and `exit` objects to the built-ins. These objects are instances of non-C classes, so I can reassign their operator overloads.
Setting `__add__` to `print` lets me use addition to print things, and setting `__pos__` to `quit` or `exit` lets me use the unary `+` operator to abort the program before the rest of the code runs. Without setting `__pos__`, I would need a bunch of additional code to make sure the "backwards" part of the code can find all the variables and attributes it needs to not fail. With `__pos__`, I only need to make sure the "backwards" code is still syntactically valid.
Forward, the code prints
```
Use quit() or Ctrl-D (i.e. EOF) to exit
```
Backward, the code prints
```
Use exit() or Ctrl-D (i.e. EOF) to exit
```
(The messages are slightly different on Windows. For platform-independent output at the expense of 3 extra bytes, you can replace the middle line with `x+1++x++2+x`, printing `1` when run forwards and `2` when run backwards.)
---
I also tried to figure out a way to do this by defining my own class instead of messing with `quit.__class__`. I got as far as the following:
```
if.1j:adbmal=1j
class ton:adbmal
a=lambda:j1.fi
j1=a
a.__dict__=a.__globals__
```
`class ton:adbmal` is one of the very few combinations of class name and class body such that the class statement is syntactically valid backward. `tressa`, `led`, `labolg`, `tropmi`, and `esiar` would also have been valid class names (with a different class body, such as `not fi`), but `ton` is the only one where the reversed name can be part of an expression, giving the most flexibility.
`if.1j:adbmal=1j` assigns a value to `adbmal` to make the class body succeed, while still being syntactically valid backward.
The stuff with `a` and `j1` lets me use `j1.ton` to refer to my `ton` class, which is still a valid expression backward.
At this point, I got stuck. I couldn't figure out how to get my class out of `j1.ton` and into a more useful variable. I can't assign attributes on `j1.ton` and still have valid syntax backward, so I can't set operator overloads. I also wanted to set [`builtins.__build_class__`](https://stackoverflow.com/questions/1832997/what-does-pythons-builtin-build-class-do) to my class so I could abuse the `class` statement to construct instances without the function call operator, but trying to put `j1.ton` on the right side of an assignment produces invalid syntax backward.
If I had been able to name my class something like `fi` or `tpecxe`, I could have used tricks like `b:j1.fi` to get the class into an annotation and then `a.__dict__=__annotations__` to get it into `a.b`, but I couldn't find any way to get the class statement and the annotation tricks to hook up. Anything that was compatible with the class statement was incompatible with the annotation tricks.
(You might wonder why I didn't abuse `builtins.__build_class__` to call an existing function directly, like `print`. I couldn't figure out a way to do that and have the output be deterministic, and I wanted deterministic output.)
[Answer]
# JavaScript, 19 bytes
Returns `true` because of the assignment at the end, since JS treats that as defining a global variable. The first part is an arrow function, which is ignored. When run backwards, `eurt` is set to `NaN` (not a number), and since `NaN` is not greater than `true` (or equal), it returns `false`.
```
eurt=>true;NaN=true
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/P7W0qMS2pKg01ZqroCgzr0TDL9EPzNf8/x8A "JavaScript (V8) – Try It Online")
```
eurt=NaN;eurt>=true
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/P7W0qMTWL9HPmqugKDOvRAPEt7MtKSpN1fz/HwA "JavaScript (V8) – Try It Online")
# JavaScript, 3 bytes
A snippet which outputs `1`, or `-1` in reverse. Very simple.
```
2-1
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/v6AoM69Ew0jXUPP/fwA "JavaScript (V8) – Try It Online")
```
1-2
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/v6AoM69Ew1DXSPP/fwA "JavaScript (V8) – Try It Online")
# JavaScript, 7 bytes
Abuses the not equal to operator and the not operator, will output `false`, or `true` in reverse. JavaScript uses `NaN` as not-a-number.
```
5==!NaN
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/v6AoM69Ew9TWVtEv0U/z/38A "JavaScript (V8) – Try It Online")
```
NaN!==5
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/v6AoM69Ewy/RT9HW1lTz/38A "JavaScript (V8) – Try It Online")
# JavaScript, 18 bytes
Another boring solution, with comments instead of subtraction. Returns `1`, or `2` in reverse. I included the `print` statements in these.
```
print(1)//)2(tnirp
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/v6AoM69Ew1BTX1/TSKMkL7Oo4P9/AA "JavaScript (V8) – Try It Online")
```
print(2)//)1(tnirp
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/v6AoM69Ew0hTX1/TUKMkL7Oo4P9/AA "JavaScript (V8) – Try It Online")
# JavaScript, 7 bytes
Similar to the previous answer, but with assignment instead of equal-to. Uses the `atob` variable, which is a builtin in browser Javascript (decodes base64). Since TIO doesn't include browser builtins, I defined it just to keep it from erroring. Works as expected in console. Return `true`, or `false` in reverse.
```
2!=atob
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/P7EkP8k2rTQvuSQzP09Ds7rWmqugKDOvRMNI0RYkp/n/PwA "JavaScript (V8) – Try It Online")
```
bota=!2
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNEts/j/P7EkP8k2rTQvuSQzP09Ds7rWmqugKDOvRCMpvyTRVtFI8/9/AA "JavaScript (V8) – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 3 bytes
```
1"_
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/DZXi/2tyFaWWpRYVp9rqKcQrGXJxpSZn5CukKRjCGJaWEJa6OoSGKocpgHEtLf8DAA "J – Try It Online")
### one or infinity...
* `1"_` is the constant 1, turned into a verb of rank `"` infinity `_`. Hence always returns 1.
* `_"1` is the constant infinity `_`, turned into a verb of rank `1`. Hence always returns infinity.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes
```
+1
```
[Try it online!](https://tio.run/##y0rNyan8/1/b8P9/AA "Jelly – Try It Online")
Prints 1.
# [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes
```
1+
```
[Try it online!](https://tio.run/##y0rNyan8/99Q@/9/AA "Jelly – Try It Online")
Prints 2.
The reason for this is that Jelly's dyad-nilad structure chains differently on either side. `+1` becomes a monad meaning "plus one", which is applied to the Left Argument, which defaults to zero. `1+` does not become a monadic chain here (if I remember correctly - correct me if my Jelly theory is off; I'm a bit rusty on the structural component), but rather is seen as `1` set as the Left Argument, and then `+` is applied as a dyad to `(left, left)` in the default case of no Right Argument, giving `1 + 1`.
Great challenge; I almost feel like this is a cheese. I don't know if I should be happy with this solution or feel bad for having such a short and trivial solution >\_<.
This uses Jelly's structure to be fancy. A more boring answer would just be `01` (prints 1) and `10` (prints 10), or any other two-digit number and its reverse (that isn't a palindrome).
[Answer]
# **bash, 12 bytes (no comments or string literals)**
```
echo 0$ ohce
```
Prints "0$ ohce"
```
echo $0 ohce
```
Prints "bash ohce"
# **bash, 11 bytes (no comments or string literals)**
```
echo ftnirp
```
Prints "ftnirp"
```
printf ohce
```
Prints "ohce"
[Answer]
# brainf\*\*\* 2 bytes
```
+.
```
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fW@//fwA "brainfuck – Try It Online")
Outputs 1 forwards, 0 backwards. Really randomdude999's answer
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 10 bytes
```
Print@ohcE
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78/z@gKDOvxCE/I9n1/38A "Wolfram Language (Mathematica) – Try It Online")
Prints `ohcE`.
```
Echo@tnirP
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78/981OSPfoSQvsyjg/38A "Wolfram Language (Mathematica) – Try It Online")
Prints `>> tnirP`.
[Answer]
# [R](https://www.r-project.org), 2 bytes
```
.1
```
Prints `0.1`.
```
1.
```
Prints `1`.
Both numeric (double).
[tio](https://tio.run/##K/r/31CPS8/w/38A)
Less trivial? and for an explicit true/false
```
2>1
# TRUE
1>2
# FALSE
```
[tio](https://tio.run/##K/r/38jOkIvL0M6I6/9/AA)
[Answer]
# [POSIX sh](https://wiki.debian.org/Shell) (Dash, Bash, Zsh, ...), 3 bytes
```
: !
```
[Try it online!](https://tio.run/##S0kszvj/30pB8T8XkOBKTc7IV1Cx51JUsIKz/wMA "Dash – Try It Online")
The builtin `:` discards its arguments and exits `0` (true). Reversed, `!` negates the exit code of `:` and exits `1` (false).
[Answer]
# [7](https://esolangs.org/wiki/7), 2 characters, 1 byte in 7's encoding
```
31
```
[Try it online! (forwards)](https://tio.run/##M///39jw/38A "7 – Try It Online")
[Try it online! (reversed)](https://tio.run/##M///39D4/38A "7 – Try It Online")
This should be the first valid 1-byte solution (because the existing 1-byte solution in BCT requires a particular value on its input to work, and isn't counting it in the byte count – that could only be assumed in a full program, and BCT full programs can't do I/O and must wipe all their working memory to be able to halt, thus have no way to halt with a value). 7's encoding packs multiple characters into a single byte: here are `xxd` hexdumps for the forward and reverse programs:
```
00000000: 67                                       g
```
```
00000000: 2f                                       /
```
This conceptually outputs a string: `31` for the forwards program, and an empty string for the backwards program. The output encoding is set to be the same as the input encoding; so if you encode the program in 7's encoding, you'll get a single byte of output which encodes the string `31` (and if you use ASCII instead, you'll get two bytes that encode the string `31` in ASCII).
## Explanation
On the first pass through the program, the `3` appends a "print and pop" command to the stack, and the `1` appends a "push empty stack element" command to the stack. So, we end up forming a program on top of the stack. At the end of the first pass through the program, 7 will run the resulting program, but without popping it from the stack.
With the forward version of the program, the "print and pop" command will attempt to print the program consisting of a "print" command and a "pop" command. That isn't a valid literal, so the 7 interpreter will construct code that's capable of constructing that stack element and print that instead; in this case, the code it finds for for "push a stack element that generates a 'print and pop' command then a 'push empty stack element command'" is `**7**31` (i.e. basically the program we wrote, although our program appends to an implicit empty stack element, whereas the reconstructed program makes a new one). The print routine interprets the `**7**` as a command to set the output encoding to the same encoding that was used for the source code, and then the `31` is interpreted as a literal and gets printed. The command in question pops two things in total (the thing it's printing and the element below), so the stack now contains no data and thus there are no more passes through the program; it just exits (even though we push an empty stack element after this point, those don't affect the end-of-program behaviour).
With the reverse program, we're pushing the empty stack element before the print attempt, rather than the other way round, so it's now an empty string that gets printed, and the remnants of the program (which are below it) get popped without printing them. Everything is now the same as in the forward program, so the reverse program also exits naturally and without error.
[Answer]
# [Keg](https://github.com/JonoCode9374/Keg), 2 bytes
```
10
```
[Try it online!](https://tio.run/##y05N///f0OD/fwA "Keg – Try It Online")
# [Keg](https://github.com/JonoCode9374/Keg), 2 bytes
```
01
```
[Try it online!](https://tio.run/##y05N///fwPD/fwA "Keg – Try It Online")
When run forwards, it prints `10`. When run backwards, it prints `01`.
I might try to create a non-trivial answer soon, as this seems like a really great challenge!
[Answer]
# [Perl 5](https://www.perl.org/), 11 bytes
```
say$-,$$yas
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVJFV0dFpTKx@P//f/kFJZn5ecX/dX1N9QwMDQA "Perl 5 – Try It Online")
Outputs `0` when run forward. Outputs the current process number followed by 0 when run backwards.
[Answer]
# [MathGolf](https://github.com/maxbergmark/mathgolf), 2 bytes
This one does not have any nilads or dyads inside the program. Just monads.
```
±(
```
[Try it online!](https://tio.run/##y00syUjPz0n7///QRo3//wE "MathGolf – Try It Online")
## Explanation
```
±  Find absolute value of the implicit 0
 ( Decrement 0, resulting -1.
```
Reversed:
```
(  Decrement 0, resulting -1.
 ± Find absolute value of -1, which results in 1.
```
[Answer]
# [Actually](https://github.com/Mego/Seriously), 2 bytes
Decrement empty value & push 1.
```
D1
```
Reversed program decrements 1, outputting 0.
```
1D
```
[Try it online!](https://tio.run/##S0wuKU3Myan8/9/F8P9/AA "Actually – Try It Online")
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
The exact same answer ported to a different language.
```
<1
```
[Try it online!](https://tio.run/##yy9OTMpM/f/fxvD/fwA "05AB1E – Try It Online")
[Answer]
# [HolyC](https://en.wikipedia.org/wiki/TempleOS), 12 bytes
Like the C version, except using the implicit print in HolyC
```
"0"; // ;"1"
```
Prints 0
```
"1"; // ;"0"
```
Prints 1
Spaces required by the compiler :)
[Answer]
# [MarioLANG](https://github.com/tomsmeding/MarioLANG), 3 bytes
```
:
+
```
[Try it online!](https://tio.run/##y00syszPScxL///fikv7/38A "MarioLANG – Try It Online")
Prints 0
```
+
:
```
[Try it online!](https://tio.run/##y00syszPScxL//9fm8vq/38A "MarioLANG – Try It Online")
Prints 1
---
# [MarioLANG](https://github.com/tomsmeding/MarioLANG), 10 bytes
```
 ==
:+
== 
```
[Try it online!](https://tio.run/##y00syszPScxL//9fwdaWy0qby9ZW4f9/AA "MarioLANG – Try It Online")
Prints 0
```
 ==
+:
== 
```
[Try it online!](https://tio.run/##y00syszPScxL//9fwdaWS9uKy9ZW4f9/AA "MarioLANG – Try It Online")
Prints 1
[Answer]
# [Poetic](https://mcaweb.matc.edu/winslojr/vicom128/final/index.html), ~~15~~ 13 bytes
```
tis,A NAMETAG
```
[Try it online!](https://mcaweb.matc.edu/winslojr/vicom128/final/tio/index.html?K8ks1nFU8HP0dQ1xdP//PykxBQA)
Prints ASCII character 1 (SOH).
```
GATEMAN A,sit
```
[Try it online!](https://mcaweb.matc.edu/winslojr/vicom128/final/tio/index.html?c3cMcfV19FNw1CnOLPn/PykxBQA)
Prints ASCII character 0 (NUL).
*The previous answer ends with an "Unexpected EOF" error forwards because the END command (any ten-letter word) is omitted, and a "Mismatched IF/EIF" error backwards because EOF is encountered before an IF/EIF loop can end. The following answer terminates properly.*
# [Poetic](https://mcaweb.matc.edu/winslojr/vicom128/final/index.html), 51 bytes
```
the difference between I and certain ridiculous men
```
[Try it online!](https://mcaweb.matc.edu/winslojr/vicom128/final/tio/index.html?BcGBDYAwCATAVX4dx6DwjST6Jkjj@PWuTyJyThblxGB/pHDAFHBWWwqVkb6uZ724qb2HxQ8)
Prints a newline.
```
nem suolucidir niatrec dna I neewteb ecnereffid eht
```
[Try it online!](https://mcaweb.matc.edu/winslojr/vicom128/final/tio/index.html?BcGBDYAwCATAVX4dx6DwjST6Jkjj@PVOvPGu51qekQWlddERMhwQ@TUH6GJxzgzw7L2HxQ8)
Prints a newline and a "vertical tab" character.
(I really wanted to be able to make the programs make sense both backwards and forwards, but I'm not sure that's possible in English, and I don't know any other languages to try that out with.)
[Answer]
# Haskell, 52 bytes
```
a=0--
--b tnirp=b#a
niam=main
1#a=niam
main=print a
```
==> prints "1"
```
a tnirp=niam
main=a#1
niam=main
a#b=print b--
--0=a
```
==> prints "0"
Explanation:
```
a=0--
-- FWD: define constant "a" to be 0 / BWD: No-op                                 --
--b tnirp=b#a
-- FWD: No-op / BWD: define a function "#" in two arguments and prints the       --
-- second                                                                        --
niam=main
-- FWD & BWD: define constant "niam" to be the same as "main"                    --
1#a=niam
-- FWD: define a function "#" in two arguments that produces "main" if the first --
-- argument is 1 / BWD: define constant "main" to be the result of the function  --
-- "#" applied to the arguments "a" and 1                                        --
main=print a
-- FWD: define constant "main" to be an IO action that prints the value of "a" / --
-- BWD: define a function "a" in one argument that always produces the value     --
-- of "niam"                                                                     --
```
Of course, there is also the shorter item:
# Haskell, 29 bytes
```
main=print 1--
--0 tnirp=niam
```
which is much less interesting.
[Answer]
# Dyalog APL
Boring solution using comments
```
0⍝1   => 0
1⍝0   => 1
```
Even more boring numeric solution:
```
10    => 10
01    => 1
```
Basic arithmetics:
```
2-1    => 1
1-2    => ¯1
```
[Answer]
# [Whispers v3](https://github.com/cairdcoinheringaahing/Whispers), 31 bytes
```
1 tuptuO >>
> 1
>> Output 1
0 >
```
[Try it online!](https://tio.run/##K8/ILC5ILSo2@v/fUKGktKCk1F/Bzo7LTsGQy85Owb@0pKC0BMg2ULD7/x8A "Whispers v2 – Try It Online"), [!enilnO tI yrT](https://tio.run/##K8/ILC5ILSo2@v/fTsGAy1ChpLSgpNRfwc4OyLbjsrNT8C8tKSgtUTD8/x8A "Whispers v2 – Try It Online")
Hooray for strict parsing rules!
The first and last lines are ignored, because they don't fit the right syntax. They come into action when reversed.
[Answer]
# [Fig](https://github.com/Seggan/Fig) 0.1.0, \$2\log\_{256}(96)\approx\$ 1.646 bytes
```
,"
```
[See the README to see how to run this](https://github.com/Seggan/Fig/blob/master/README.md)
Argh. Beaten by Halfwit by more than half a byte. In the forward position, it prints a single newline. Backwards, `",`, it prints a comma followed by a newline.
[Answer]
# [Make](https://www.gnu.org/software/make/), ~~14~~ 15 bytes
```
x:#
	#$@$#	
#:y
```
[Try it online!](https://tio.run/##y03MTv3/v8JKmYtTWcVBRZmTS9mq8v9/AA "Make – Try It Online")
*Updated to add a trailing tab on the second line...*
Here's another one that's not as short, but seems interesting enough to post...
Forwards it prints `x` and backwards it prints `y`. It works by referencing the `$@` symbol, which is defined as the target being made. The "command" run is just a comment to the shell, so it's a no-op. But by default Make echos the commands it runs.
Also, the `$#` reference doesn't cause an error, and evaluates to an empty string, which allows `#$@$#` to work both directions without having to add more characters.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 4 bits1, 0.5 [bytes](https://github.com/Vyxal/Vyncode/blob/main/README.md)
```
2
```
[Try it Online! (link is to bitstring)](https://vyxal.pythonanywhere.com/?v=1#WyIhIiwiIiwiMDEwMSIsIiIsIiJd) The bitstring form of this is `0101`, which translates to 2.
Reversed - [Try it Online!](https://vyxal.pythonanywhere.com/?v=1#WyIhIiwiIiwiMTAxMCIsIiIsIiJd) (outputs 0)
If we stretch the rules a bit, we can get two bits: [Try it Online!](https://vyxal.pythonanywhere.com/?v=1#WyIhIiwiIiwiMTAiLCIiLCIiXQ==) [!enilnO ti yrT](https://vyxal.pythonanywhere.com/?v=1#WyIhIiwiIiwiMDEiLCIiLCIiXQ==), which respectively output an empty string and 0 - 0 and 1 in unary.
[Answer]
# [Python 3](https://docs.python.org/3/), 17 bytes
```
print(1)#)2(tnirp
```
[Try it online!](https://tio.run/##K6gsycjPM/7/v6AoM69Ew1BTWdNIoyQvs6jg/38A "Python 3 – Try It Online")
I promise this is the last trivial/cheese one I post; I'm trying to think of a more interesting solution. If I remember I'll see where I can get with this.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 2 bytes
```
\"
```
[Try it online!](https://tio.run/##K6gsyfj/P0bp/38A "Pyth – Try It Online")
Returns the string ' " ' (one set of double quotes)
# [Pyth](https://github.com/isaacg1/pyth), 2 bytes
```
"\
```
[Try it online!](https://tio.run/##K6gsyfj/Xynm/38A "Pyth – Try It Online")
Returns "\"
Oops, my earlier answer missed that they had to be the same data type. This answer returns two different strings, and relies on the fact that '\' makes a one character string of the input and that Pyth closes strings implicitly
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 2 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
1g
```
Returns `1`. Reverse returns `-1`.
`g` is the sign function when it has no arguments, and returns the sign of the argument minus the caller if called with an argument. So `g1` would be the sign of zero minus one because the default input is 0
[Test it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=MWc)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 2 bytes
Push 1 onto the stack & negates. (This results in -1)
```
1(
```
Negate empty value & push 1. Output 1 implicitly.
```
(1
```
[Try it online!](https://tio.run/##yy9OTMpM/f/fUOP/fwA "05AB1E – Try It Online")
[Answer]
## Ruby, 6 bytes
```
p:stup
```
Output
```
:stup
```
Reversed output 
```
p
```
[Answer]
# Ceylon (Snippet), 20
The same trivial thing as in many other languages:
```
print(1);//;)2(tnirp
```
Outputs 1.
```
print(2);//;)1(tnirp
```
Outputs 2.
Given that parentheses need to be in the right order and you need `print` for output, I don't think this can be improved.
A full program or function needs even more braces/parentheses mirrored, so no chance of getting it better.
# Ceylon (anonymous function), 17
If we don't need to output anything, but just return it from an anonymous function, then this is enough:
```
()=>//
1.2
//>=)(
```
A function which returns 1.2 (a floating point value).
```
()=>//
2.1
//>=)(
```
A function which returns 2.1 (a floating point value).
# Ceylon (expression with return value), 3
If we accept just an expression (which then can be printed), then we don't even need any comments:
```
2.1
```
Gives 2.1 (a floating point value).
```
1.2
```
Gives 1.2 (a floating point value).
[Try all of them online](https://try.ceylon-lang.org/?gist=03f2449ba0a874bd89d095ea1e4aeb94)
[Answer]
# [Wren](https://github.com/munificent/wren), 32 bytes
Basically just a port of the Python answer.
```
System.write(1)//)0(etirw.metsyS
```
[Try it online!](https://tio.run/##Ky9Kzfv/P7iyuCQ1V6@8KLMkVcNQU19f00AjtSSzqFwvN7WkuDL4/38A)
]