[Question]
  [
# Introduction
Classically, booleans are one bit; `true` or `false`, `1` or `0`. Leading zeros would just be redundant. For example, `001` means the same as `00001` or just `1`.
# The 32-bit boolean
Given a truthy/falsey value, output the equivalent 32-bit boolean as a string.
 (Or as a number if for *some reason* your language supports leading zeros.)
**Your program doesn't have to work for every truthy/falsy type, only what your programming language work best for.**
# Example i/o
```
Input >> Output
truthy >> 00000000000000000000000000000001
falsey >> 00000000000000000000000000000000
```
## This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so lowest bytes wins!
  
[Answer]
# [Python 3](https://docs.python.org/3/), ~~33~~ ~~25~~ ~~18~~ 15 bytes
Thanks @jurjen-bos for the `__mod__` tip.
```
'%.32d'.__mod__
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzX11Vz9goRV0vPj43PyU@/n9BUWZeiUaahqGmJheMbYDEDikqTUXiuiXmFAP5/wE "Python 3 ‚Äì Try It Online")
[Answer]
# x86-16 Machine Code (DOS), 16 bytes
```
B4 02          mov  ah,  2
B2 30          mov  dl, '0'
B9 1F 00       mov  cx, 31
            PrintZeros:
CD 21          int  0x21
E2 FC          loop PrintZeros
00 CA          add  dl, bl
CD 21          int  0x21
C3             ret
```
The above function receives a boolean value (0 == falsey, 1 == truthy) in the `BL` register (low byte of `BX`), and prints a "redundant boolean" string to the standard output.
It works by invoking an interrupt (0x21) to make a DOS function call (selected by setting `AH` to 2) that prints a single character (in `DL`) to the standard output.
First, the ASCII character '0' is loaded into `DL`, the counter (`CX`) is set to 31, and it loops to print the "redundant" bytes. Then, the input boolean value is added to `DL` (if `BL` is falsey, adding 0 will leave `DL` unchanged as ASCII '0'; if `BL` is truthy, `DL` will be incremented by one to ASCII '1'), and the final byte is printed.
The function does not return a value.
Pretty decent for a language that doesn't really do strings.
---
### Full Program, 21 bytes
If you want to make it into a full program, only 5 more bytes are required. Instead of passing the input in a register, this reads the input from the arguments passed on the command line when invoking the application. An argument of 0 is interpreted as falsey, as is the complete lack of arguments; an argument greater than 0 is interpreted as truthy.
Simply assemble the following code as a COM program, and then execute it on the command line.
```
B4 02            mov   ah,  2
B2 30            mov   dl, '0'
B9 1F 00         mov   cx, 31
               PrintZeros:
CD 21            int   0x21
E2 FC            loop  PrintZeros
3A 16 82 00      cmp   dl, BYTE PTR [0x82]  ; compare to 2nd arg, at offset 0x82 in PSP
D6               salc                       ; equivalent to sbb al, al
28 C2            sub   dl, al
CD 21            int   0x21
C3               ret                        ; you can simply 'ret' to end a COM program
```
Sample Output:
```
C:\>bool.com
00000000000000000000000000000000
C:\>bool.com 0
00000000000000000000000000000000
C:\>bool.com 1
00000000000000000000000000000001 
C:\>bool.com 2
00000000000000000000000000000001
C:\>bool.com 7
00000000000000000000000000000001
```
How does it work? Well, it's basically the same thing, until you get down to the `CMP` instruction. This compares the command-line argument with the value of the `DL` register (which, you recall, contains an ASCII '0'). In a COM program, the bytes of code are loaded at offset 0x100. Preceding that is the [program segment prefix (PSP)](https://en.wikipedia.org/wiki/Program_Segment_Prefix), which contains information about the state of a DOS program. Specifically, at offset 0x82, you find the first (actually the second, since the first is a space) argument that was specified on the command line when the program was invoked. So, we are just comparing this byte against an ASCII '0'.
The comparison sets the flags, and then the `SALC` instruction (an undocumented opcode prior to the Pentium, equivalent to `sbb al, al`, but only 1 byte instead of 2) sets `AL` to 0 if the two values were equal, or -1 if they were different. It is then obvious that when we subtract `AL` from `DL`, this results in either ASCII '0' or '1', as appropriate.
(Note that, somewhat ironically, you will break it if you pass an argument with a leading 0 on the command line, since it looks only at the first character. So `01` will be treated as falsey. :-)
[Answer]
# [Python 3](https://docs.python.org/3/), 23 bytes
```
lambda n:'0'*31+'01'[n]
```
[Try it online!](https://tio.run/##K6gsycjPM/6fZhvzPycxNyklUSHPSt1AXcvYUFvdwFA9Oi/2f0FRZl6JRpqGW2JOcaqmJheMH1JUCuT@BwA "Python 3 ‚Äì Try It Online")
[Answer]
# Javascript, 23 bytes
```
a=>'0'.repeat(31)+ +!!a
```
`!!a` coerces a into a boolean, which the unary plus turns into an int.
[Answer]
# [V](https://github.com/DJMcMayhem/V), 8 bytes
```
32√©0√Ä√±l
```
[Try it online!](https://tio.run/##K/v/39jo8EqDww2HNzLm/P//3wAA "V ‚Äì Try It Online")
Explanation:
```
32√©0            " Insert 32 '0's
    √Ä√±          " Arg1 times...
      <C-a>     "   Increment the number under the cursor
           l    "   Move one char to the right. This will break the loop since there is 
                "   no more room on this line
```
[Answer]
# [Neim](https://github.com/okx-code/Neim), 6 5 bytes
```
·õùŒ®Œ≤_I
```
[Try it online!](https://tio.run/##y0vNzP3//@HsuedWnNsU7/n/vyEA)
Explanation:
```
 ·õù        # Constant 31
  Œ®       # Apply next token to all in list
    Œ≤     # Constant 0
     _    # Push each element to stack
      I   # Take Line of input.
```
Saved a byte thanks to *Okx*
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 17 bytes
```
@(n)dec2bin(n,32)
```
Anonymous function. Works in MATLAB too.
[Try it online!](https://tio.run/##y08uSSxL/Z@mYKugp6f330EjTzMlNdkoKTNPI0/H2Ejzf5pGSVFpqiZXmkZaYk5xquZ/AA "Octave ‚Äì Try It Online")
[Answer]
# [ArnoldC](https://lhartikk.github.io/ArnoldC/), 369 bytes
```
IT'S SHOWTIME
HEY CHRISTMAS TREE A
YOU SET US UP 0
GET YOUR ASS TO MARS A
DO IT NOW
I WANT TO ASK YOU A BUNCH OF QUESTIONS AND I WANT TO HAVE THEM ANSWERED IMMEDIATELY
BECAUSE I'M GOING TO SAY PLEASE A
TALK TO THE HAND "00000000000000000000000000000001"
BULLSHIT
TALK TO THE HAND "00000000000000000000000000000000"
YOU HAVE NO RESPECT FOR LOGIC
YOU HAVE BEEN TERMINATED
```
[Try it online!](https://tio.run/##lVC7bsMwDNz1FQcvWd1PoGXGIqKHK1I1PBbNWLRA/x9w5SzZCpQTcS8c@f7z9f15/zgOsYtCQ9lMErvAO3yoopZIYZUZ5PbSoGxoirZidEvfO1ZB2jUFiap22Vwghlw2J9go20mR3k4pCFPLPqBc8dpYTUruljzjKQ30xrDAqeO6ceVOpsSzkHHc3cSemjLkkrAUycvpUdqxRiY9axrF2wn2jB7Ws4fx73kZ3NRi1CD2f/M4PP7yaJ0LKuvK3nAtFbEs4p/sxJxhXJPkfsp8HOMv "ArnoldC ‚Äì Try It Online")
[Answer]
# [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck), ~~61~~ ~~60~~ 36 bytes
```
++++[>++++<-]>[>++>+++<<-]>-[>.<-]>>,.
```
~~I'm sure there is a clever way of not moving around so much with the pointers.~~ 
I was right. There were. Thanks to @Graviton for giving me the idea!
Next step: Get the values 32 and 48 quicker!
[Try it online!](https://tio.run/##SypKzMxLK03O/v9fGwii7UCkjW6sHYgF4tiAOLrRdnpAWkfv/38DAA "brainfuck ‚Äì Try It Online")
```
++++        - Increment 1st slot by 4
[           - Loop until 4 becomes 0
    >++++   - Add 4 to 2nd slot
    <-      - Decrement loop
]           - At this point, we point to slot 1 and slot 2 contains 16, which is the Greatest Common Divisor of 48 (value 0 in ASCII) and 32 (final length of answer)
>           - Point to value 16 (slot 2)
[           - Start loop to get our target values 32 and 48
    >++     - Point to slot 3 and multiply 16 by 2 = 32
    >+++    - Point to slot 4 and multiply 16 by 3 = 48
    <<-     - Decrement the loop so that slot 2 becomes 0
]           - We now point slot 2
>-          - Move to slot 3 and remove one so we can spam (output) 31 zeroes
[           - Start outputting until slot 3 is empty
    >.      - Move to slot 4 where our ASCII value for 0 is
    <-      - Decrement the loop so that slot 3 becomes 0
]           - We are now at slot 3 and it is empty.
,.          - We can now gather input from the user and output it.
```
Was fun for a first Golf!
~~It has gotten way too late now.~~ What am I even doing
[Answer]
# Scala, 32 bytes
Sorry but I was forced to do it in 32 bytes >\_<
```
var s=t
for(u<-0 to 30)s="0"+s
s
```
It's enclosed by a function taking `t` as parameter (as a `string` that can be "0" or "1" for resp. falsy or truthy), and `s` is returned.
[Try It Online!](https://tio.run/##K05OzEn8n5@UlZpcouCbmJmnkFpRkpqXUqzgWFBQzcWZkpqmUJJvbJSkUWIVXFKUmZeuCaVtq/@XJRYpFNuWcKXlF2mU2ugaAFUqGBtoFtsqGShpF3MV/6/l4ioAqi3JydNQMlTQtVNQ0oYYpmSopKmJkDNAkTMAydX@BwA)
# Valid response : Scala, 46 bytes
Same as my java response, I was supposed to take a boolean for the parameter. So :
```
var s=if(t)"1"else"0"
for(u<-0 to 30)s="0"+s
s
```
[Try It Online!](https://tio.run/##TYxBCsIwEADP5hVLTgmlkNpbsYLePfmCtN1IJSQluxWh9O0xB0GvM8zQaL3NcXjiyHCzcwB8M4aJ4LIsmzhM6IBjexwUd9cYPdqguzunOTz6Lb9sAupnp1jLRqInlEYKF5NaT7UpIbRGU19gRYLyLsRSSvZByQbqM8jq@04rav2T5l86W77F7vkD)
[Answer]
# [Braingolf](https://github.com/gunnerwolf/braingolf), ~~10~~ 8 bytes
```
#‚êü>[0_]N
```
[Try it online!](https://tio.run/##SypKzMxLz89J@/9fWd4u2iA@1u/////mAA "Braingolf ‚Äì Try It Online")
`‚êü` is a Unit Separator, ASCII `0x1F`, or 31. Can't find the actually character to paste into TIO, so TIO instead uses `# 1-`, which pushes space (32) and decrements to 31.
## Explanation
```
#‚êü>[0_]N  Implicit input from commandline args
#‚êü        Push unit separator (31)
   >       Move top item to bottom of stack
    [..]   Loop, runs 31 times
     0_    Print 0
        N  Boolean conversion, truthy values become 1, falsey values become 0
           Implicit output of top of stack
```
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 23 bytes
```
@(x)[48+[!(1:31),x],'']
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo0IzOiU12SgpM0/DQMfYUFOnQtvEIvZ/mkZJUWmqJleaRlpiTnGq5n8A "Octave ‚Äì Try It Online")
This is shorter than all the approaches I tried with `printf`. I might have missed something though, since I did this on my phone.
Only one byte longer
```
@(x)[dec2bin(0,31),x+48]
```
This could be 18 bytes if I could take 1/0 as strings.
```
@(x)[48+!(1:31),x]
```
[Try it online!](https://tio.run/##y08uSSxL/Z9mq6en999Bo0Iz2sRCW1HD0MrYUFOnIvZ/moa6obomF5AyUNf8DwA "Octave ‚Äì Try It Online")
[Answer]
# Java 8, ~~31~~ 27 bytes
```
b->"".format("%032d",b?1:0)
```
-4 bytes thanks to *@OlivierGr√©goire*.
[Try it here.](https://tio.run/##dY5BCsIwEEX3PcUQEFKwoepOUU9gNy7FxSRNJTVNSjMtiPTsNdpuhZnF8P/jTY0DZr7Vri6fk7IYAlzQuHcCYBzprkKlofieAFfqjHuA4tJ7q9GBTA8xGOPGCYRkFBTg4AiTzE6Micp3DRJnq3y3Ldlanjf7PJ0OM9D20kZg4QZvSmiims@a2x0wXbyvQLoRvifRxois404oTl2v098HfysV2rB0xmScPg)
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 5 bytes
```
¬æ31√ó¬´
```
[Try it online!](https://tio.run/##MzBNTDJM/f//0D5jw8PTD63@/98QAA "05AB1E ‚Äì Try It Online")
[Answer]
# Ruby, 21 bytes
Yeah, that space needs to be there.. :/
```
->x{"%032b"%(x ?1:0)}
```
In Ruby *everything* except `false` and `nil` is truthy;
[Try it online!](https://tio.run/##DcTdCkAwGAbgW3lbKeqj4UzhElyAHJi2EBKbn3Dts4Pn2Yy4rcptWFwP83iaCOb5F8o448FnV6N31MswEVQ77ZKgN@PmhJiQEBhz@sFdiVF2Olrk2URzu@LBe7xQ9dHgsz8 "Ruby ‚Äì Try It Online")
[Answer]
# Mathematica, 36 bytes
```
""<>ToString/@PadLeft[{Boole@#},31]&
```
# Mathematica, 26 bytes
```
Row@PadLeft[{Boole@#},31]&
```
[Try it online!](https://tio.run/##y00sychMLv6fZvs/KL/cISAxxSc1rSS62ik/PyfVQblWx9gwVu1/QFFmXomCQ5qCQ0hRaSoXguuWmFOMzNcwtDPQROHbGGj@BwA "Mathics ‚Äì Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 5 bytes
```
√ó0¬≥¬πÔº≥
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRCMkMze1WEPdQF3H2FBT01oBIuqZV1BaElwCZKdrAEX//zf8r1v2X7c4BwA "Charcoal ‚Äì Try It Online") (Link to the verbose version.)
As Charcoal understand `0` and `1` as `True` or `False`, this just prints 31 `0`s and the input (`0` or `1`) as string.
[Answer]
# [Python 2](https://docs.python.org/2/), ~~26~~ 25 bytes
Thanks to *Erik the Outgolfer* for saving a byte!
Goes for the full program approach:
```
print+bool(input(31*'0'))
```
[Try it online!](https://tio.run/##K6gsycjPM/r/v6AoM69EOyk/P0cjM6@gtETD2FBL3UBdU/P/fxMA "Python 2 ‚Äì Try It Online")
[Answer]
# [Unwanted, Unnecessary, Opportunistic](https://github.com/faso/Unwanted-Unnecessary-Opportunistic), 7 bytes
```
P0M31P*
```
Pass either 1 or 0 into the register.
[Answer]
# C, 26 bytes
Pretty much the same idea as [1bluestone's solution](https://codegolf.stackexchange.com/a/133327/63856), but in C it's shorter, and it does work correctly for any integer input:
```
f(a){printf("%032i",!!a);}
```
Of course, this includes some implicitly typed variables/functions as all good C-golf answers do... The `!!` operator is the shortest way to convert any truthy value to `1` in C (via double negation, `!` is defined to return either `1` or `0`).
Test with:
```
#include <stdio.h>
f(a){printf("%032i",!!a);}
int main() {
    f(0), printf("\n");
    f(1), printf("\n");
    f(2), printf("\n");
    f(-1), printf("\n");
}
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~37~~ 32 bytes
```
(('0'<$[1..31])++).show.fromEnum
```
[Try it online!](https://tio.run/##y0gszk7Nyflfraus4OPo5x7q6O6q4BwQoKCsW8uVZhvzX0ND3UDdRiXaUE/P2DBWU1tbU684I79cL60oP9c1rzT3f25iZp6CrUJuYoFvvIJGQWlJcEmRT55emqZCtFtiTnGqTkhRaWrsfwA "Haskell ‚Äì Try It Online")
Thanks @nimi for `-5` bytes!
[Answer]
# PHP, 28 bytes
```
<?=str_pad($argv[1],32,0,0);
```
Save as bool.php and run:
```
$ php bool.php 0
00000000000000000000000000000000
$ php bool.php 1
00000000000000000000000000000001
```
[Answer]
# [Ly](http://esolangs.org/wiki/Ly), ~~20~~ ~~15~~ 13 bytes
```
65*1+[0u1-]nu
```
EDIT: Saved 5 bytes thanks to ovs.  
EDIT: Saved another 2 bytes by printing 0 as a number rather than a character.
[Answer]
# Octave,~~16~~ 11 bytes
```
@(x)x(1:32)
```
[Try it online!](https://tio.run/##y08uSSxL/f/fQaNCs0LD0MrYSPN/mm1iXrE1V5qGkgF@YKikSYQqgxgDoLr/AA "Octave ‚Äì Try It Online")
A function handle that takes `"00000000000000000000000000000001"` as truthy and
`"00000000000000000000000000000000\0"` as falsey.
Explanation:
In Octave an array is considered as falsey if at least one of its elements is zero. The 33th element of the second string is a character with the ASCII value of 0 so it can be considered as falsey.
[Answer]
# Java, 40 chars, 40 bytes
This takes string as parameter, which is not correct (falsy/truthy java value is forced by OP to be represented by a boolean).
```
c->{for(int i=0;++i<32;c=0+c);return c;}
```
[Try It Online!](https://tio.run/##dY2xCsMgFEV3v@KRSQkNaTvadM/QqWPpYI0JpokGfQZK8NutlKzdLhzOPaNYxcEuyozdO8lJeA83oc1GtEHleiEVtBu5o9NmAKT7kIxHAkA8CtQSWgjQQJKH69ZbR7MKuql5WerL@cRlU5dZcAqDMyB5TJyQJbymbO4Hq9UdzLm7Bx5PEG7wLJc/HtVc2YDVkglOhoYKaVEXjPG/9PijkcT0BQ)
# Valid response : Java, 60 chars, 60 bytes
```
c->{String k="";for(k+=c?1:0;k.length()<32;k=0+k);return k;}
```
[Try It Online!](https://tio.run/##dY6xDsIgFAB3vuLFCWJsqm5ide7g5GgcnkgrgtDAw8Q0/fbaqKvzXS53xycuQqf9/WpH5TAlOKDxPTOedGxQaah7dqRofAvELyE4jR6UkANjiZCMghoyVDCqxa7/ibaazWQTIrfzSu2Xm1Lawmnf0o2L7XolbVXOrZBRU44erBxGyViXL26q/aLPYK7wmFb4t3k6A8Y2iWnmlUg/ipCp6CZCzvNcEG/QJS2E/Mcp5g8e2DC@AQ)
I know there is already a Java answer which is shorter than this one, but still :)
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~13~~ 11 bytes
```
?1:0 ¬§i31√ß0
```
## Explanation:
```
?1:0 ¬§i31√ß0
?              // If the input is a truthy, return:
 1             //   1
  :0           //   Else, 0
     ¬§         // Convert to a base-2 string
      i        // Insert at index 0:
       31√ß0    //   A string filled with 0s, length 31
```
Saved a byte using a base-2 conversion built-in! 
To insert the string of 0s in front of the `1`/`0`, I need to cast the `1` and `0` into a string. The typical way of doing that would be `1s‚ÄÉ` (3 bytes). But because we're only converting 1s and 0s, I can use the base-2 built-in `1¬§` (2 bytes).
---
Input can be in the form of an integer or string. 
`0` and `""` are falsy in Japt.
[Try it online!](https://tio.run/##y0osKPn/397QykDh0JJMY8PDyw3@/zcEAA)
[Test suite](https://tio.run/##y0osKPn//9DiCHtDKwOFQ0syjQ0PLzf4/z9aSUlHKS0/X0nHQMcwVkE3CAA)
[Answer]
# [C# (.NET Core)](https://www.microsoft.com/net/core/platform), 29 bytes
```
a=>new string('0',31)+(a?1:0)
```
OP said 1/0 can be used for truthy/falsey, so can make `a` an int and it becomes
```
a=>new string('0',31)+a
```
C# doesn't really have truthy/falsey though so I will not use this answer.
[Try it online!](https://tio.run/##dY6xCsIwFEX3fMXbTLBKi5u1dRCcFAQHB3F4xrQE0gTyUkWk317T1tU73nMuXEkL6bzqW9K2hvObgmpyxqRBIjh5V3ts2IdBDAUMWsLT6QccUVtOwcfR9QboaxKjM5lD9q2Vm7tzJoHJK6GKFRTAgPVYlFa9foTP0lmyysSc4zZbp6KPB3bOkjNqefE6qIO2ig9rHnyrhMj/4QoNjTwe6FjH@i8)
[Answer]
# [MY](https://bitbucket.org/zacharyjtaylor/my-language/src/728aa9b047892569a2bd5a15d54c68dd3bae0bb2?at=master), ~~10~~ 9 bytes
```
ùï´B·πÑi‚ÑëpŒ≠‚Üê‚Üê
```
[Try it online!](https://tio.run/##y638///D3KmrnR7ubMl81DKx4NzaR20TgOj/f8P/AA)
Explanation (codepage [with reasoning behind the character]/hex code):
```
ùï´: 1A - Push an integer from STDIN (lowercase integers)
B: 0B - Push 11 (B is 11 in hex)
·πÑ: 36 - Pop n; push the nth prime, 11th prime is 31 (·πÑ-th)
i: 49 - Pop n; push [1,...,n] (index/iota)
‚Ñë: 34 - Pop n; push imag(n) (‚Ñëmaginary part, applied to each element, which gives 0 for real numbers)
p: 60 - Pop n; push stringified n (0=>"0" ... 35=>"Z", the b in base upside down)
Œ≠: 56 - Pop n; push n joined by "" (Œ≠mpty string)
‚Üê: 26 - Pop n; output n with no newline (out‚Üêin)
‚Üê: 26 - Pop n; output n with no newline (out‚Üêin)
```
I can't believe that this is possible without any two-argument commands whatsoever!
Edit: Saved 1 byte by using primes instead of arithmetic to get 31.
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 5 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
‚å°√ñ‚îú‚å°‚Üí
```
[Run and debug it](https://staxlang.xyz/#p=f599c3f51a&i=1%0A0)
Numeric 0 and empty lists are considered falsy. All other values are truthy.
[Answer]
# Julia 0.6, 12 bytes
```
~x=bin(x,32)
```
Nothing clever here, there is basically a built in for it.
]