text:
Implement a Truth-Machine
A truth-machine (credits goes to this guy for coming up with it) is a very simple program designed to demonstrate the I/O and control flow of a language. Here's what a truth-machine does:

Gets a number (either 0 or 1) from STDIN.
If that number is 0, print out 0 and terminate.
If that number is 1, print out 1 forever.

Challenge
Write a truth-machine as described above in your language of choice. The truth-machine must be a full program that follows these rules:

take input from STDIN or an acceptable alternative

If your language cannot take input from STDIN, it may take input from a hardcoded variable or suitable equivalent in the program

must output to STDOUT or an acceptable alternative

If your language is incapable of outputting the characters 0 or 1, byte or unary I/O is acceptable.

when the input is 1, it must continually print 1s and only stop if the program is killed or runs out of memory
the output must only be either a 0 followed by either one or no newline or space, or infinite 1s with each 1 followed by either one or no newline or space. No other output can be generated, except constant output of your language's interpreter that cannot be suppressed (such as a greeting, ANSI color codes or indentation). Your usage of newlines or spaces must be consistent: for example, if you choose to output 1 with a newline after it all 1s must have a newline after them.
if and only if your language cannot possibly terminate on an input of 0 it is acceptable for the code to enter an infinite loop in which nothing is outputted.

Since this is a catalog, languages created after this challenge are allowed to compete. Note that there must be an interpreter so the submission can be tested. It is allowed (and even encouraged) to write this interpreter yourself for a previously unimplemented language. Other than that, all the standard rules of code-golf must be obeyed. Submissions in most languages will be scored in bytes in an appropriate preexisting encoding (usually UTF-8).
Catalog
The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:
## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:
## [><>](http://esolangs.org/wiki/Fish), 121 bytes

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Shortest Solution by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Can we assume that the program halts when the processor finishes executing the written code, for a machine code entry?

@ThomasKwa Yes.

Assuming any behaviour is fine for all invalid inputs?

@Cruncher Yes, the only inputs you should expect to get are 0 and 1.

Is it alright if I just have single spaces between the 1s?

@El'endiaStarman Sure. I'll add that to the rules.

Catalog is borked.

Catalog appears to consider Bf and bf to be different languages.

Without having looked at all of them, I suspect a significant number of entries here to be expecting inputs of "0\n" or "1\n". I expect this was expected by @quartata but it's not necessarily explicit in the challenge. Is there a standard definition of "input a number" somewhere on meta?

Are non-zero exit codes ok? Also, can I forgo a space that would normally separate the 1s? (i.e. 11 1 1 1 1 1 1 1) I assume not for the second question.

is exiting with an error allowed?

@12Me21 This is allowed by default on all challenges.

Is taking input as \x00 and \x01 over STDIN allowed?

@CalculatorFeline "If your language is incapable of outputting the characters 0 or 1, byte or unary I/O is acceptable."

Well, my language does allow that, so :( RIP Newbiefuck, 4 bytes: ,[.] I/O as \x00 and \x01

While attempting this, I made a program that does just the opposite, when given zero it prints out infinite zeroes, and when given 1, does nothing

Can the form of 1 change—is 1 1/1 1/1 1/1... allowed?

Is one allowed to print an infinite number of 1s? That is, not print out 1s forever, but print out an infinite list of 1s all at once? This would be theoretically demonstrated, but the language has no notion of printing more than once. It just generates an output. So is it okay if it runs indefinitely, but would print infinite 1s given infinite time (to finish executing)?

Hexagony, 6 bytes
This was surprisingly tricky, and I'm not convinced it's optimal...
<.@!$?

After padding and unfolding the code, this represents the following hex grid:

This uses a similar control flow like my recent error-free cat program, moving along anti-diagonals. To achieve that we start by deflecting the instruction pointer (IP) to the left, where the purple path wraps around to the lower left corner.
? reads the input as an integer. ! prints it back. . is just a no-op. Now the corner of the grid acts as a branch:
If the input was 0, the IP will continue along the red path, which simply terminates the program with @.
If the input was 1, the IP will continue on the green path. Again, . is just a no-op, but $ is the equivalent of Befunge's trampoline: it skips the next instruction. After wrapping, the next instruction would be the ?, but due to $ execution actually continues on the blue path, starting with ! to print another copy of the 1. This loop which only contains !..$ is now repeated indefinitely.
A study of control flow in Hexagony...
I believe the above solution is optimal. I've written a brute forcer, which checks all 6-byte Hexagony programs, which contain at least one each of ?!@ (which are necessary; I've also checked : and % in place of @ to terminate with a division-by-zero error, but that didn't help either). The check prints all the programs which a) produce a 0 on input 0 and terminate and b) produce at least two 1s (and nothing else) and don't terminate within the first 60 ticks of the program (200 ticks for 5-byte solutions). I doubt that any valid solution would take more than 200 ticks to correctly print the first 0 or the second 1 on such a small grid, so I don't think I've missed out on any potential solutions.
The search didn't yield any results for 5 bytes, but 57 results for 6 bytes (using @; there's no need to terminate with an error if we can solve this cleanly in the same amount of bytes). Of those 57 only 6 were false positives which actually printed only two 1s and then entered an infinite loop without printing any more. One solution was listed twice because it contained two ! commands. That leaves exactly 50 valid solutions.
There is a certain amount of degeneracy between the solutions where one or two characters are not substantial, e.g. because they're effectively no-ops anyway. The solutions can be grouped into 23 sets of genuinely distinct programs (in some cases, there is only a single character difference between two sets, but it changes the control flow substantially, so I've counted them separately). Two of the groups even make use of multiple instruction pointers in a very unexpected way. As I would never have come up with most of these ways to use the branches and mirrors, they make a very interesting study of what sorts of control flow are possible in Hexagony, and I have definitely learned some new tricks for future golfs.
The overall control flow is almost always the same: read a number, print it. If it's 0 find a way to the @, if not keep looping through the ! while mainting an edge value of 1. There are four notable exceptions:

One solution (the one with two !) prints two 1s per iteration through the grid, therefore printing about twice as fast as the majority of programs. I've marked this one with x2 below.
A few solutions (those which contain an o) replace the 1 with a 111 (the character code of o), so they print three 1s per iteration, making them print about three times as fast as the majority of programs. I've marked these with x3 below.
Two solutions append a 1 to the edge value in each iteration (so 1 --> 11 --> 111 --> ...). Those print very fast, but they'll run out of memory eventually. I've marked these with OoM below.
Two solutions enter a very tight loop which merely bounces back and forth over the !, printing on every other tick (instead of of every 5th or so), which makes them slightly faster (and neater). I've marked these with >< below.

So here is the entire zoo:
#1                #5                #12                #19
?!/$.@            ?$!>$@            .?!/$@             |!|?$@  # ><
?!/$1@  # OoM     ?$!|$@            =?!/$@
?!/$=@                                                 #20
?!/$\@            #6                #13                $@.?<!
?!/$o@  # x3      ?/!<|@            .?/!$@             $@1?<!  # OoM
?!/$!@  # x2                        =?/!$@             $@=?<!
                  #7                                   $@o?<!  # x3
#2                ?\!<|@            #14
?!>$)@                              \!?__@             #21
?!>$1@            #8                                   _>_!?@
?!>$o@  # x3      ?<!>$@  # ><      #15
?!|$)@                              \_?!$@             #22
?!|$1@            #9                                   <!@.$?
?!|$o@  # x3      ?\$!@$            #16                <!@/$?
                                    \_?!_@             <!@=$?
#3                #10                                  <$@!$?
?!|)$@            ?~#!@)            #17                <.@!$?
?!|1$@            ?~#!@1            $$?\@!             </@!$?
?!|o$@  # x3                                           <=@!$?
                  #11               #18
#4                ?$)\@!            \$?\@!             #23
?_!<@>            ?$1\@!                               <<@]!?
                  ?$o\@!  # x3

The following is a short walkthrough for a handful of the more representative groups. Especially groups 10 and 23 are worth checking out. There are many other interesting and sometimes convoluted paths in the other groups, but I think I've bored you enough at the end of this. For anyone who really wants to learn Hexagony, these are definitely worth investigating though, as they exhibit even more possible uses of the mirrors and $.
Group 1
This one isn't much more elaborate than my original solution, but the paths go in different directions. It also allows for the largest number of variations in a single cell, as the right-most no-op can be replaced with 5 different commands which still make this valid without changing the structure:

Group 2
This one is quite interesting, because it only moves horizontally. After wrapping to the >, the IP reverses immediately, taking the branch in the corner. It's not entirely well visibly no the diagram, but in the case of the 1 we traverse the first row again, but backwards this time. This also means we run into ? again, which now returns 0 (EOF). This is fixed with ) (increment) to keep printing 1s. This also has 5 variations, as ) could also be 1 or o, and > could also be |:

Group 3
This one looks almost identical to the previous one but it's messy as hell. Up to hitting | and then traversing the bottom or top row it's the same. But in the case of a loop, the $ now skips over the ) onto the mirror. So we follow the turquoise path to the right, now hit the increment, skip over the @ before we wrap around to the | again and then go back to the green path at the top.

Group 4
I thought this one was particularly nifty:

The _ mirror in the top right corner is initially a no-op, so we print with ! and hit the <. The 0 path now hits the horizontal mirror and terminates. The 1 path takes a really interesting trajectory though: it deflects down, wraps to the !, gets redirected towards the horizontal and then wraps back to the ! again. It then keeps moving in this rhombus shape, printing twice per iteration (every third tick).
Group 8
This is one of the two solutions with a really tight printing loop:

The < acts as the branch. After wrapping twice, 0 hits @. 1 on the other hand, first skips the ?, then > sends it onto the the $ again, so that is skips the @. Then the IP wraps into the turquoise path, where it bounces back and forth between the > and < (wrapping around the edge in between).
Group 10
One of two groups which use other instruction pointers, and it's absolutely beautiful. Hexagony has 6 - each one starts from a different corner along the clockwise edge, but only one of them is active at a time.

As usual, we read with ?. Now ~ is unary negation: it turns the 1 into a -1. Next, we hit the #. This is one way to switch between IPs: it takes the current edge value modulo 6 and switches to the corresponding IP (IPs are numbered from 0 in the clockwise direction). So if the input was 0, then the IP simply remains the same, and travels boringly straight ahead into !@. But if the input was 1, then the current value is -1 which is 5 (mod 6). So we switch to the IP which starts on the very same cell (the green path). Now # is a no-op and ? sets the memory edge to 0. ) increments so ! prints a 1. Now we hit ~ again to ensure that # is still a no-op (as opposed to switching us to IP 1 which would terminate the program). It's mindblowing how well everything fits together in this little program.
Group 22
Just to note, this is the group my original solution is in. It also happens to be largest group, because the no-op can be in two different places, and there are several choices for the actual (effective no-op) command.
Group 23
This is the other group using multiple IPs. In fact this one uses 3 different IPs. The top right corner is a bit of a mess, but I'll try to walk you through this:

So, the beginning you've seen before: < deflects North-East, ? reads input. Now ] is another way to change between IPs: it hands control to the next IP in clockwise order. So we switch control to the turquoise path which (I know it's hard to see) starts in the North-East corner going South-East. It is immediately reflected by the < so that it wraps to the South-East corner, going North-West. It also hits the ] so we switch to the next IP. This is the grey path starting in the East corner, going South-West. It prints the input, then wraps to the North-East corner. < deflects the path into the horizontal, where it is reflected by the other <. Now the right-hand < acts as a branch: if the input was 0, the IP moves North-East, and wraps to the @. If the input was 1, the IP moves to the !, wraps to the lef-thand < where it is reflected... now in the corner, it wraps back to the !, gets deflected by the the right <, reflected by the left < and the paths starts over...
Quite a mess, but a beautiful mess. :)

Diagrams generated with Timwi's amazing HexagonyColorer.

whoa. just whoa.

@ThomasOltmann I admit this answer assumes some basic knowledge of the language. If you're actually interested in learning more about it, I've gone through the basics in this answer and in this answer, but I won't blame you if you're not. ;)

Motorola MC14500B Machine Code, 2 bytes
In hex:
58EC

Explanation:
5  OR the register with input from the data bus
8  Write the register to the data bus
E  Skip next instruction if register is zero
C  Jump

The Motorola MC14500B is a 1-bit microcontroller; it has one 1-bit register and a 1-bit data bus. Since the opcodes are 4 bits each, there are only sixteen; half of them carry out a logical operation between the register and the bit on the data bus.
The jump instruction sets a jump flag; when no address is provided, it is common to set the program counter to 0. If the input bit was zero, the processor will not jump. If the input bit was 1, the processor jumps back to the start; since we're ORing with input, it doesn't matter what the input signal is afterwards—the register will then be 1 forever.
As is conventional, the register is initialized to 0.
A list of the opcodes can be found on the data sheet, or here.

2 bytes is definitely the minimum for this challenge.

@CᴏɴᴏʀO'Bʀɪᴇɴ I've been looking for several hours through esolangs and lists of 4-bit processors to see if there's a 1 or 1.5, and haven't found one.

Definitely the right tool for the job.

Link is borked atm...

@TheDoctor Both links work fine for me

@Mego he must have changed it... It was another site yesterday

Is there a simulator for MC14500B that I can try?

Are you sure that this works? I think this wouldn't halt even if the input is 0, according to the handbook. Refer to page 11 of the handbook: The PC counts up sequentially in binary to its highest value and "wraps around" to zero and counts up again.

@petStorm That quote is an example of one possible configuration for the microcontroller. Another possible configuration could have it execute a finite program, which is what I was implicitly assuming. If it does wrap around, 58AB would still work for 2 bytes by disabling the input and output pins after one output on input 0.

Arnold C, 296 Bytes
IT'S SHOWTIME
    HEY CHRISTMAS TREE i
    YOU SET US UP @NO PROBLEMO
    BECAUSE I'M GOING TO SAY PLEASE i
        STICK AROUND i
            TALK TO THE HAND i
        CHILL
    BULLSHIT
        TALK TO THE HAND i
    YOU HAVE NO RESPECT FOR LOGIC
YOU HAVE BEEN TERMINATED

Not really competitive, but for the fun of it.
Does not support stdin, replace @NO PROBLEMO with @I LIED for a zero value. @No Problemo is 1.
Run with (assuming file is truthmachine.arnoldc):
wget http://lhartikk.github.io/ArnoldC.jar
java -jar ArnoldC.jar truthmachine.arnoldc
java truthmachine

Beautiful. I cried 10/10

@ThomasKwa I think you have to use tabs for it to parse correctly. I haven't used this language in a while though, could be wrong.

BECAUSE I'M GOING TO SAY PLEASE LOL

It looks like this does if(i){while(i) print(i);} else {print(i);} Surely it would be shorter to do print(i);while(i) print(i);?

Although BULLSHIT has a great contribution to the entertainment value of the program, technically it is unnecessary. You can factor the whole BULLSHIT branch out by moving TALK TO THE HAND i after YOU HAVE NO RESPECT FOR LOGIC.

@GaborSch There is only one proper response to that: BULLSHIT ;)

@user00001 YOU HAVE NO RESPECT FOR LOGIC :D

Minecraft, 18 Bytes (MC Version 15w45a)

As you can see, there is a lever directed into the repeating command block, which has the command say 1 in it. There is an signal inverting torch on top of that, which directs power into the single-run command block with the command say 0 in it.
Whenever the switch is directed towards truthy, the repeater block uses the code say 1 to output infinite 1s. When the lever is redirected to false, it outputs a single 0.
Note that this outputs a [@] by default. If you really want just straight up 1s and zeros, this becomes 34 bytes, where the code in the command blocks are tellraw @a [1] and tellraw @a [0]. This is using @Cᴏɴᴏʀ O'Bʀɪᴇɴ's suggested byte count for MC as can be found in Meta.

You used a video game for code golf. +1

@RK. This is actually fairly standard practice for simple challenges. There are at least two other users who use MC as a code golfing language - try the search bar with is:answer Minecraft. c:

@FlagAsSpam lol nicely done. Also, thanks for that tip to search MC answers.

Bash + GNU utils, 13
grep 0||yes 1

Bash, 35
read n;for((;n;));{ echo 1;};echo 0

You know, I was wondering if a bash solution with yes would be possible...

Nice! That's pretty clever

Microscript, 3 bytes
i{p

The shortest one I know.
Explanation:
i  Takes numeric input and puts it in register 1
{  while register 1 is truthy
  p  Print the contents of register 1

Microscript has implicit printing of register 1 upon termination, which is the reason why an input of 0 gets printed once.

@quartata I matched you :D

@CᴏɴᴏʀO'Bʀɪᴇɴ :O

I'm seriously wondering if you wrote the question first, or the answer...

The question. I just wanted to post this since it was the shortest one I came up with while writing the question. It is a catalog so there aren't any real winners.

Ruby, 20
print while/1/||gets

Run from the command line to avoid warnings, as
ruby -e "print while/1/||gets" <<< 0
ruby -e "print while/1/||gets" <<< 1

Explanation:
Less golfed, this is
while /1/ || gets
  print
end

When a Regexp is used in a conditional, it evaluates as falsey unless the variable $_ is populated and matches the pattern. On the first time through the loop, $_ is empty so we fall through to gets, which sets the value of $_ to a line read from STDIN. print with no arguments prints $_. Now we evaluate the conditional again. If we read in 1, we short-circuit and just print 1 again, and so on forever. Otherwise, we fall through to gets, but since there's no second line of input, gets returns nil, so the loop ends.

It's nice when trivial tasks still allow mindblowing solutions even in "normal" languages. :)

The ||gets part is cool and all, but can't you just do gets;print while/1/ and save a byte?

No, then it doesn't print the 0 at all.

Turing Machine Code, 32 22 bytes
Using the rule table syntax found here.
0 0 0 * halt
0 * 1 r 0

I really like this. +1

I knew someone would've already posted this!

Python 2, 29 bytes
a=input()
while 1:print a;1/a

This terminates with a division error on 0, which is allowed by default.

STDERR output is fine. The ><> answer uses it as well.

This is brilliant ^_^

Would while a print a work? Sorry, I dont know python.

@RohanJhunjhunwala For 0, it wouldn't print anything, but it should print it once.

@xnor oh, my bad.

A new user (@SeoFernando) suggested a golf, replacing a;a/1 with a/a.

JavaScript, 28 bytes
For loops are often shorter than while loops.
alert(x) returns undefined, which is falsy, so the bitwise or operator, |, casts it to 0. Thus, if x is "0", alert once, otherwise keep looping. Uses alert for STDOUT like this answer.
for(x=prompt();alert(x)|x;);

Shoot, you beat me to it. I was about to post exactly this! :) GG

Wow, that's a good bit more clever than mine :) Have a +1!

You don't need the trailing semicolon.

@CᴏɴᴏʀO'Bʀɪᴇɴ What browser did you use? I tested it on Firefox and Chrome and I get a SyntaxError without it.

@intrepidcoder Oh, sorry, my bad. My mind was in "trailing semicolons are useless" mode. ^^"

Yeah, you need one because it's a for loop. :)

Nice job, placing the alert in the condition was clever

e=>{do{alert(e)}while(e)} 25 bytes

Pyth, 4 3 2
Wp

There is a no! trailing space (thanks isaac :) ). The space used to be required to make the while loop compile, but Pyth has since been updated. Normally that would disqualify using it, but since this is a catalog it should be valid.
Explanation:
Wp        : implicit Q = eval(input)
W         : while
 p        : print and return the value of Q, to be evaluated as the while condition
          : Functions without enough arguments automatically use Q now
          : do nothing in the body of the while loop

I was inspied by this answer to add implicit pass to Pyth. The space is now unnecessary. https://pyth.herokuapp.com/?code=WpQ&input=0&debug=0

Crossed four still looks like a four.

Eh, I'm just getting so bored of seing pyth dominate everything all the time :(. LOL.

@AshwinGupta my language technically beat it, so it's not completely dominating :)

@Cyoce yeah! Good job! I rest assured that something can beat pyth lol.

@AshwinGupta my other language did too :D

Wp now works.

@muddyfish Thanks for the reminder, edited! :)

@AshwinGupta My language beats both of Cyoce's languages.

Brainfuck, 41 36 31 30 bytes
Shortened by printing once right after input and with help from Ethan and user46915.
,.+++[->>+<-----<]>>---<-[>.<]

Previous version: Subtract 48 from the input, and if it's not zero, add 1 to the 48 to print ASCII 1 forever, otherwise print 0.
-[>+<-----]>--->,<[->->+<<]>[>+<]>.<[>.<]

I ran it here, but due to buffered output, you cannot see any output since the program never terminates on 1.
Edit: I had forgotten to print 0 on input 0. Fixed now. I like the >.< faces at the end.

@ThomasKwa I'm guessing not, but I'm not sure since I don't see an algorithm specifically for modulo 2. The divmod algorithm is a little long.

You can shorten it a bit more by merging the pieces of code together a bit better and directly using your input register instead of having a separate "48" register:
,.[>+>+<<-]-[>-<-----]>+++[>.<]

Attempted a solution with mod 2.  Definitely looks like subtracting 48 is the right way to go.  ,.[->+>+<<]>>[->[>-<[-]]>+[<+>-]<<]>[<<.>>]

You might want to mention that this assumes 8 bit cells with wraparound on underflow, in case anyone is trying to run it on an interpreter that works differently.

@Ray That's the default and is generally assumed. Had I used another implementation, I would've said so.

I like it when emoji appear in my code, too.

You can get one more byte off by combining subtraction and copying together: ,.+++[->>+<-----<]>>---<-[>.<]

Piet, 27 18 16 codels
(Codel is a fancy name for pixel used to avoid confusion when an image is stretched for viewing. I counted codels instead of bytes because piet scripts are saved as images, so the physical size may vary. I think an ideal file format that would save this piet as efficiently as possible would take 11 bytes. In practice, my tiny gif file is 62 bytes, with optimal palette data. Tell me if I should use this as the size of my entry instead of the codel amount.)
Original image:
Enlarged:
In piet, the difference between two colors is what determines which command runs, so seeing the same color twice doesn't mean it does the same action. The execution begins in the top-left codel. Then it moves horizontally, performing the following:

Read a number and put it on the stack
Duplicate the top of the stack
Pop and output the top of the stack
Pop the top of the stack and rotate clockwise that number of times.

If the input was 1, the cursor then moves down into the lime codel, which pushes 1 on the stack. Then the execution continues going left. When the cursor passes from a color to white and from white to a color, nothing happens. Since black is considered as walls too, the cursor ends up going back to the lime codel on the top line, and repeats the whole thing from step 2.
If, however, the input was 0, the cursor will never go down and will end up in the blue J on the right (pun intended, it was worth it), were it will stay trapped (because the top, right, left and bottom sides of this J-shaped block are next to black codels or the edge of the image). Since the cursor is trapped, execution ends.
Unexpected values:
If the user writes another number, it will still be printed, then the cursor will rotate more or less times based on the value.

Multiple of 4 or 0: execution continues horizontally and ends.
Multiple of 3: Since going up is impossible, the cursor immediately rotates clockwise and continues horizontally, then ends.
Multiple of 2 and not a multiple of 4: the cursor rotates and starts moving to the left. Luckily, all this does is perform a bunch of operations that don't affect the program flow and end up emptying the stack. When an operation can't be done because the stack is empty, it is simply ignored. When it hits the top left corner, the cursor has nowhere else to go but to the right again, effectively restarting the program.
Other values: The cursor goes down as if it would with 1, which makes it print 1 forever. If the input is 5, the output will be 5111111111111...

Any non-integer value will terminate the program. Execution will continue normally, but all operations will be ignored since there is nothing in the stack. So in a way, the program never crashes - it either stops normally or loops forever.

PietDev friendly version
PietDev (a very basic online Piet IDE) seems to have trouble with white codels so I made a new version which manually rotates back up instead of relying on proper white codel automatic rotation. And I didn't even need to use a new color! If you want to test with it, make sure you draw a black border around the code because PietDev doesn't support custom program sizes.

Older versions
The first version didn't push 1 back on the stack and instead looped back to an earlier duplication instruction. It also had decorative useless codels.

Then I had the idea to push 1 on the stack to remove the blank line. It's funny how I thought of it thanks to my decorative codels.

Then I realized I had an extraneous dup that wasn't needed anymore, and I reduced the number of colors to save up on palette data in the image. I also got rid of the single decorative codel because I don't know.

I've never seen a Piet answer scored in anything other than codels, but I think the optimal byte count is also interesting to include :)

There are 20 different codel values, which means you should be able to pack three codels into 13 bits, then eight triplets into 13 bytes for a storage density of 2.6 codels per byte. But someone has to define that language first. I suggest the name DPPi = densely packed piet.

@JanDvorak I counted 21 values to add a special one for line break, and once you're got the first line break the parser can guess where the other ones should be. But I didn't go as far as combining codels into triplets, which makes much more sense than wasting 5 bits per codel. Clever.

Just add the dimensions as the first couple of bytes. You don't need an extra symbol.

@everyone who wants to try it out: Don’t try this solution with PietDev because PietDev only prints a single 1 and terminates. But the solution works properly with npiet.

@ML Indeed, PietDev doesn't implement white codels correctly it seems.

@JacqueGoupil, I think it might be the cc that’s not implemented properly? And another problem is that PietDev uses float division instead of integer division.

@ML Good to know. Here, I edited the post and added a PietDev friendly version.

If you count each codel reasonably, a "comparable score" for this answer would be ~69.15 bits (or ~8.64 bytes, less humorously)

Chip, 6 bytes
e*faAs

Chip is a 2D language that behaves a bit like an integrated circuit. It takes input, one byte at a time, and breaks out the bits to individual input elements. Output stitches the values of output elements back together into bytes.
Let's break this down:
* is a source signal, it will send a true value to all adjacent elements.
e and f correspond to the fifth and sixth bit of the output.
So, e*f produces binary 00110000, which is ASCII char "0".
Now, A is the first bit of input and a is the first bit of output, so aA copies that bit from input to output. So, when combined with e*f, an input of ASCII "0" produces "0", and "1" produces "1". (There is no interaction between f and a, since neither produce any signal.)
The s on the end, when activated by a true signal, will prevent input from advancing to the next byte, meaning that the whole thing will run again with the same input.
Since the first byte of "0" is zero, it won't activate this element and the program will print "0", and thereby exhaust its input, which allows it to terminate. "1", however, activates this element, which means that "1" is output, but not consumed on the input, allowing the cycle to repeat indefinitely.
If values 0x0 and 0x1 are used for output, rather than ASCII, we can eliminate the e*f part, resulting in only 3 bytes:
aAs

If the zero must terminate itself, rather than expecting stdin to close, we get the following, which inverts the first byte with ~, and passes the result to t, which terminates the program (10 bytes):
aA~te*f
 s

(t also produces no signal, so there is no interaction between t and e.)

Nice answer! Since this is a catalog challenge, there's no need to mark this as non-competing, so I've removed that bit for you. Welcome to PPCG!

I took the liberty of adding Chip to TIO. Try it online!

@Dennis, question for you: how would I get TIO to update its source? Last week I fixed a bug in the Chip interpreter, but it hasn't propagated the change into TIO. Is this something I need to ask someone to do for me?

I've pulled Chip. If you need something updated, just leave a message in http://talk.tryitonline.net.

Brainbool, 5 bytes
,.[.]

Brainbool is Brainfuck, but it only operates on bits, and does I/O through 0 and 1 characters.

I knew there had to be a BF derivative where this could be feasibly done.

I feel like "Boolfuck" might be a better name for it, but well done regardless.

@JamesMurphy it seems that exists already: https://esolangs.org/wiki/Boolfuck

LOLCODE, 119 bytes
GIMMEH n
n R SUM OF n AN 0
BOTH SAEM n AN 0, O RLY?
YA RLY
 VISIBLE 0
NO WAI
 IM IN UR l
  VISIBLE 1
 IM OUTTA UR l
OIC

Ungolfed:
HAI

BTW, Read n as a string from STDIN and convert to an integer
GIMMEH n
n R SUM OF n AN 0

BTW, Test n for equality with 0
BOTH SAEM n AN 0, O RLY?
YA RLY
    BTW, Write 0 to STDOUT and exit
    VISIBLE 0
NO WAI
    BTW, Loop forever, printing 1
    IM IN YR l
        VISIBLE 1
    IM OUTTA YR l
OIC

KTHXBYE

Which interpreter are you using? 2. Can you MAEK n A NUMBR to cast? 3. Can you use DIFFRINT instead of BOTH SAEM and switch the conditionals?

@ThomasKwa I was using LOLCOFFEE, the one on repl.it. (Which appears to be down at the moment, so I'll test your suggestions once it's back up.)

Doesn't O RLY? cast to boolean?

@LeakyNun No...? O RLY? is like a postfix if.

Bitwise Cyclic Tag, 3 bits or < 1 byte
Bitwise Cyclic Tag is one of the simplest Turing-complete languages out there. It works with two bitstrings, the program and the data. The bits of the program are read cyclically and interpreted as follows:

0: Delete the first data bit (and output it, in implementations that have output).
1x: If the first data bit is 1, append x (representing either 0 or 1) to the end of the data. (If the first data bit is 0, do nothing.)

The program runs until the data string is empty.
Truth-machine
110

When the data string is set to 0:

11 does not append anything because the first data bit is not 1.
0 deletes/outputs 0.
The data string is now empty and the program halts.

When the data string is set to 1:

11 appends a 1.
0 deletes/outputs 1.
The data string is back to a single 1 and the program is back to where it started, so we loop forever.

Labyrinth, 7 bytes
 ?+
@!:

Labyrinth is a 2D stack-based language where control flow depends on the sign of the top element of the stack, checked after every instruction. Execution begins moving rightward from the first valid instruction on the top row, which here is the ?.
The relevant instructions are:
?      Input integer
+      Add top two elements (Labyrinth's stack has infinite 0s on the bottom)
:      Duplicate top element
!      Output as number
@      Terminate program

If the input is 0, the IP reads input with ?, adds the top two of the stack (0 + 0 = 0), then duplicates : and outputs ! a 0. Here we encounter the sole junction in the program, and have to check the top of the stack to determine where to go. Since the top is 0, we move forward and terminate with @.
On the other hand, if the input is 1, we do the same instruction as before (but outputting a 1) before reaching the junction at the !. Now the top of the stack is positive, causing us to turn right into the ?. On EOF Labyrinth pushes 0, so we do 0 + 1 = 1 at the +, duplicate :, and output !. Once again we have a 1 at the top of the stack and the loop continues.
For a bonus, here's @MartinBüttner's 7 byte solution, which operates similarly:
?+!@
1!

Note that, unlike most languages, 1 actually pops n off the stack and pushes n*10 + 1, making the building up of large numbers easy. However, since the top of the stack is empty at that point, it's no different from merely pushing 1.

><>, 7 bytes
i2%:n:,

This uses the fact that ><> pushes -1 on EOF, which is 1 mod 2. It also uses divide by 0 for termination (which is apparently okay since the consensus is that STDERR output is ignored).
Just for reference, exiting cleanly without errors is an extra byte:
i2%:n?!;

i2%:n?. With input on the stack like the other answers, this could be just :?:n

C, 37 bytes
A different take on how to do it in C.
main(c){for(gets(&c);putchar(c)&1;);}

c defaults to an int of value 1. gets(&c) gets a string from stdin, here clobbering the value of c, hackishly since c is not a char*. putchar(c) prints the value of c to stdout, and returns c. Since '0' is 48 and '1' is 49 in ASCII, we can use the last bit (&1) to determine which it is. If it's '0', the loop breaks. Otherwise, it goes forever.
Compiles (with a warning about gets) and runs under gcc-4.8 on Linux.

Presumably this only works on little-endian architectures.

@Neil I would assume so.

@Neil Endianness only affects byte order in multibyte values.

@LegionMammal978 c defaults to an int, which is a multibyte value, and on a big-endian architecture, gets will set the wrong byte.

><>, 6 bytes
::n?!;

Pushes the input on the stack to start
:        copy top element on stack
 :       copy top element on stack again
  n      pop and outputs top element
   ?     condition trampoline - pops top element, if it is zero skips next instruction
    !    trampoline skips next instruction
     ;   finish execution

Here at PPCG, we love our explanations. +1

I'm pretty sure this only works with literal 0 and 1 inputs, when it's supposed to work with 48 ('0') and 49 ('1'). Am I mistaken?

@quartata If it was me I'd say that, to be fair to any answers that use from more traditional methods of getting input, you should have to put 48 or 49 on the stack. It's your challenge though and it's not a huge deal anyway so ¯\(ツ)/¯

There's another problem with this: if the stack is pre-populated, then you have to add 3 bytes for the -v flag.

@El'endiaStarman It's 3 bytes now? I have seen 1 byte, and usually use 2 bytes. Is there a rule somewhere for this? Anyway I agree taking input directly on the stack isn't natural for ><> and should be mentionned.

@Aaron This answer contains the only consensus we have on counting flags. By that, it's 3 bytes.

@MartinBüttner thanks for the feedback ! However, I'm unsure where the value comes from, maybe are you counting the required space after -v  ? I'm referring to the "options to request different behaviors from the interpreter" section.

@Aaron Yes, exactly. It's only one byte, if you can combine it with some standard flag anyway, e.g. in the case of perl perl -pe "perl code here" where you'd need -e and the space anyway.

@MartinBüttner ok, it seems fair indeed, I'll make sure to use the correct value in future answers and will try to fix my older answers.

@Aaron: For what it's worth, I too thought it was 2 bytes for -v, then I was corrected. So you're not the only one. :)

APL, 6 bytes
→⎕←⍣⍲⎕

Explanation:
     ⎕ Read the input, then
 ⎕←    write it out
   ⍣   repeatedly
    ⍲  until NAND of it with itself becomes true.
→      Branch to zero to avoid printing the result again.

Are the second and the last characters supposed to look different? Because they don't for me.

@JanDvorak Nope, they're the same.

OK, now I'm looking at it on mobile and everything but the two arrows looks the same to me :-D

Seriously, 4 3 bytes
Crossed-out 4 is still 4 :(
,W■

, reads a value from STDIN. W starts a loop that runs while the value on top of the stack is truthy, with the body ■. ■ prints the top stack element without popping. The loop is implicitly closed at EOF.
On input of 0, the loop never executes (since 0 is falsey), and the program ends at EOF, automatically popping and printing every value on the stack. On input of 1 (or any value that is not 0, "", or []), the loop runs infinitely.
In Actually, the leading , is not needed (thanks to implicit input), bringing the score down to 2 bytes.

GNU sed, 10
:;/1/{p;b}

Explanation

: define an unnamed label
/1/ If input matches the regex 1, then
p print the pattern space (i.e. 1)
b and jump back to the unnamed label (forever)
If the input was not 1 (i.e. 0), then the pattern space is printed unmodified and the program ends.

Shave 1 character off using :;p;/1/b and the n flag, for a total of 9 bytes. Since sed -f is used anyway to run the script file, adding that extra flag doesn't require 2 bytes.

Brian & Chuck, 21 bytes
,}<-{-?<SOH>_{+?
_>+{?<.p

Here, <SOH> should be replaced with the corresponding control character (0x01).
Explanation
The basic idea is to subtract the character code of the input (48 or 49) from the p at the end of Chuck, which will either give a ? (which is a valid command) or a @ which is a no-op.
, reads the input character into Chuck's first cell (marked with _). We want to decrement this value down to 0 in a loop, while making some other changes:
}< moves to the p and - decrements it. Then { moves back to the input cell - decrements that as well. As long as this isn't zero yet, ? gives control to Chuck. Now > moves Brian's tape head one cell to the right (which is initialised to 1) and + increments that. Then we reset the loop with {?.
By the time the first cell on Chuck hits 0, the <SOH> cell will have been incremented to the character we've read from STDIN and p will be ? for input 1 or @ for input 0.
Now ? doesn't switch control any more. The 0 or 1 after it is a no-op, as is the null-byte (represented by _). { moves back to Chuck's first cell and + increments to ensure that it's positive, such that ? hands control over to Chuck.
This time >+ increments the cell after the end of Brian's initial tape. That cell is garbage but we'll never use it. Now { doesn't scan all the way to the front of Brian's tape, but only to the _. Hence ? is a no-op because the current cell is zero. Then <. moves one to the left (the copy of the input character) and prints it.
Finally, we encounter the ? or @. If the input was 0 and this cell is @ it's a no-op and the program terminates. But if the input was 1 and this cell is ? we hand over to Brian whose {+? will reset the loop on Chuck, and now we're printing 1s forever (until the integer in the cell at the end of Brian's tape doesn't fit into memory any more, I suppose...).
Bonus
Sp3000 and I have been golfing away at this for several days. We started out around 40 bytes and arrived at two completely different, but tied solutions at 26 bytes. Only when I started to write up the explanation for mine, did the 21-byte solution above occur to me. Many thanks to Sp for throwing ideas around and teaching each other some golfing tricks in B&C. :)
This is his 26 byte solution:
>,----{?{>1?0
#I<?_}<.<<<?

And this is mine:
,{>-<-?_0+?_1{<?
_®{?_{>.?

Where ® is a byte with value 174 (e.g. just save the file as ISO 8859-1).
At the core mine works similarly to the 21-byte solution, in that ® becomes } for input 1 and ~ (no-op) for input 0, but the execution is much less elegant.
His solution is quite neat in that the source code is ASCII-only and that it doesn't require a loop to process the input. Instead, ---- turns 1 into - and 0 into , (a no-op for Chuck). That - will then change the first ? on Brian's tape into a >, thereby creating different control flow for the 1-case.

Thue, 34 bytes
1::=12
2::=~1
0::=~0
@::=:::
::=
@

Explanation:
1::=12 Instances of the substring "1" can become "12"
2::=~1 Instances of the substring "2" can be removed, printing "1"
0::=~0 Instances of the substring "0" can be removed, printing "0"
@::=::: Instances of the substring "@" can be replaced with strings from the input
::=     End list of substitution rules
@       The initial string is "@"

Arnold C, 134 bytes
IT'S SHOWTIME
HEY CHRISTMAS TREE i
YOU SET US UP 0         //or 1
STICK AROUND i
TALK TO THE HAND 1
CHILL
TALK TO THE HAND 0
YOU HAVE BEEN TERMINATED

While this isn't as entertaining as the other ArnoldC answer, it's golfed. For example, indentation is unnecessary, and so are the macros @NO PROBLEMO and @I LIED.
Tested with this version of the language, which cannot take input.

Cubix, 5 6 bytes
Cubix is @ETHproductions new 2 dimensional language where the commands are wrapped around the faces of a cube. Online interpreter
Thanks to @ETHproductions for the saving.
!I\@O

This ends up expanded out to the cube
  !
I \ @ O
  .

This starts with the I command.  Input an integer onto the stack.
\, redirects the instruction pointer down over the no op.
O, outputs the numeric value of top of stack.
!, skip the next command (@) if top of stack true.  This will jump the \  redirect if 1
\, redirects the instruction pointer to the @ exit program.
This takes advantage of the fact the stack isn't popped by the O ? ! commands.

Nice. I'm really glad to see someone else using my language :) I have another 6-byte solution that only uses 5 instructions (plus a no-op), so perhaps I'll post that.

@ETHproductions post it for sure.  I think you've got a promising language here :)

You can save a byte by removing the ? and just using !: !I\@O

@ETHproductions very nice

I've written a brute-forcer for this (warning: freezes your browser for a minute or two), which comes up with exactly five 5-byte solutions: @IOw!, @I?Ov, @!IOw, !IOW@, !I\@O

Foo, 6 bytes
&1($i)

Input is hardcoded as the second character, since Foo doesn't have STDIN input. Don't we agree that Foo is awesome now? :)
Explanation
&1          Set current cell to 1
  (  )      Do-while loop (or, at least according to the interpreter)
   $i       Print current cell as int

I always liked Foo.

Perl, 18 + 1 = 19 13 + 1 = 14 bytes
print while$_

Run like this:
echo -n NUM | perl -p truth.pl

Thanks to ThisSuitIsBlackNot (who is way better at Perl golfing than me) for golfing off five bytes.

Statement modifiers are your friend! Also, if you ensure that the input has no trailing newline, you can drop the +0: echo -n 0 | perl -pe'print while$_' (13 bytes + 1 for -p). perl -M5.010 -pe'say while$_' would be even shorter, but that results in inconsistent newlines between 0 vs. 1.

@ThisSuitIsBlackNot Ah-ha! I tried print while$_ but I couldn't figure out why it didn't work. I didn't realize you couldn't have the trailing newline on the input.

Yep, the string 0 is false but 0 + newline is true. See perldoc perlsyn.

say is shorter, even if you count -E as an extra byte.

@Dennis As I mentioned in my first comment, say doesn't work for this because it leaves a newline after 1, but no newline after 0, which violates the rule that usage of newlines must be consistent.

@Dennis ...which I just realized can be fixed with -l: perl -lpE 'say while$_' (11 bytes + 2 for -lp).

MarioLANG, 11 8 bytes
;:
[^
=:

This prints a space after each 0 or 1 (as has been clarified is acceptable). The program was tested in the Ruby interpreter. It's not clear whether this behaviour of ^ is according to spec, but it works consistently in this implementation.
As usual, = is just some ground for Mario to walk on.

; reads an integer from STDIN into the current tape cell.
[ is a conditional. If the tape cell is 0, Mario skips the next cell (the ^), which will make him fall through the : (printing the 0), off the bottom edge and terminate the program (poor Mario). If the tape cell is 1, this does nothing, and execution continues.
^ is a jump command. It stops Mario from moving forward and sends him straight up one cell before he falls back down. For some reason (at least in this implementation) Mario can jump in mid-air provided there's another cell (even a space) below the jump. That means Mario repeatedly jumps into the top :, printing the 1, falls back down onto the ^ and performs another jump. This must be a feature from the popular Super Ninja Brothers spin-off.

Aww, poor mario.

PlatyPar, 2 Bytes
wA

Explanation:
Implicit: push input to the stack.
w: while last item.
A: alert last item.
If you give it something truthy, while(stack[-1]) goes on infinitely. If not, it skips that, and alerts the last item of the stack implicitly (falsy).
Try it online!
Press cancel instead of ok on the alert if you want to stop the loop after giving a 1.

why Platy? Is it different from normal Par?

After extensive research, I failed to discover there was already a language named Par. I found this as someone had posted an answer in a language called Par (not mine), and I was getting credit for his answers, and vice-versa. I have renamed mine, as I am sure the other came first (mine is only a week old).

Ouroboros, 11 7 bytes
Inspired by Sp3000's ><> answer.
r.*.n!(

Each line of code in an Ouroboros program represents a snake eating its tail.
r reads a number from input, or -1 for EOF. .* squares it, keeping 0 and 1 the same but mapping -1 to 1. .n outputs the number, leaving a copy on the stack. Finally, !( logically negates and  eats that many characters of the end of the snake. If the number was 0, this eats one character, the (, which is also the current instruction. Since the instruction pointer was swallowed, the snake dies and the program ends. If the number was 1, this eats zero characters, and execution loops back to the beginning of the snake, repeating indefinitely.
Try it:

// Define Stack class
function Stack() {
  this.stack = [];
  this.length = 0;
}
Stack.prototype.push = function(item) {
  this.stack.push(item);
  this.length++;
}
Stack.prototype.pop = function() {
  var result = 0;
  if (this.length > 0) {
    result = this.stack.pop();
    this.length--;
  }
  return result;
}
Stack.prototype.top = function() {
  var result = 0;
  if (this.length > 0) {
    result = this.stack[this.length - 1];
  }
  return result;
}
Stack.prototype.toString = function() {
  return "" + this.stack;
}

// Define Snake class
function Snake(code) {
  this.code = code;
  this.length = this.code.length;
  this.ip = 0;
  this.ownStack = new Stack();
  this.currStack = this.ownStack;
  this.alive = true;
  this.wait = 0;
  this.partialString = this.partialNumber = null;
}
Snake.prototype.step = function() {
  if (!this.alive) {
    return null;
  }
  if (this.wait > 0) {
    this.wait--;
    return null;
  }
  var instruction = this.code.charAt(this.ip);
  var output = null;
  console.log("Executing instruction " + instruction);
  if (this.partialString !== null) {
    // We're in the middle of a double-quoted string
    if (instruction == '"') {
      // Close the string and push its character codes in reverse order
      for (var i = this.partialString.length - 1; i >= 0; i--) {
        this.currStack.push(this.partialString.charCodeAt(i));
      }
      this.partialString = null;
    } else {
      this.partialString += instruction;
    }
  } else if (instruction == '"') {
    this.partialString = "";
  } else if ("0" <= instruction && instruction <= "9") {
    if (this.partialNumber !== null) {
      this.partialNumber = this.partialNumber + instruction;  // NB: concatenation!
    } else {
      this.partialNumber = instruction;
    }
    next = this.code.charAt((this.ip + 1) % this.length);
    if (next < "0" || "9" < next) {
      // Next instruction is non-numeric, so end number and push it
      this.currStack.push(+this.partialNumber);
      this.partialNumber = null;
    }
  } else if ("a" <= instruction && instruction <= "f") {
    // a-f push numbers 10 through 15
    var value = instruction.charCodeAt(0) - 87;
    this.currStack.push(value);
  } else if (instruction == "$") {
    // Toggle the current stack
    if (this.currStack === this.ownStack) {
      this.currStack = this.program.sharedStack;
    } else {
      this.currStack = this.ownStack;
    }
  } else if (instruction == "s") {
    this.currStack = this.ownStack;
  } else if (instruction == "S") {
    this.currStack = this.program.sharedStack;
  } else if (instruction == "l") {
    this.currStack.push(this.ownStack.length);
  } else if (instruction == "L") {
    this.currStack.push(this.program.sharedStack.length);
  } else if (instruction == ".") {
    var item = this.currStack.pop();
    this.currStack.push(item);
    this.currStack.push(item);
  } else if (instruction == "m") {
    var item = this.ownStack.pop();
    this.program.sharedStack.push(item);
  } else if (instruction == "M") {
    var item = this.program.sharedStack.pop();
    this.ownStack.push(item);
  } else if (instruction == "y") {
    var item = this.ownStack.top();
    this.program.sharedStack.push(item);
  } else if (instruction == "Y") {
    var item = this.program.sharedStack.top();
    this.ownStack.push(item);
  } else if (instruction == "\\") {
    var top = this.currStack.pop();
    var next = this.currStack.pop()
    this.currStack.push(top);
    this.currStack.push(next);
  } else if (instruction == "@") {
    var c = this.currStack.pop();
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(c);
    this.currStack.push(a);
    this.currStack.push(b);
  } else if (instruction == ";") {
    this.currStack.pop();
  } else if (instruction == "+") {
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(a + b);
  } else if (instruction == "-") {
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(a - b);
  } else if (instruction == "*") {
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(a * b);
  } else if (instruction == "/") {
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(a / b);
  } else if (instruction == "%") {
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(a % b);
  } else if (instruction == "_") {
    this.currStack.push(-this.currStack.pop());
  } else if (instruction == "I") {
    var value = this.currStack.pop();
    if (value < 0) {
      this.currStack.push(Math.ceil(value));
    } else {
      this.currStack.push(Math.floor(value));
    }
  } else if (instruction == ">") {
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(+(a > b));
  } else if (instruction == "<") {
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(+(a < b));
  } else if (instruction == "=") {
    var b = this.currStack.pop();
    var a = this.currStack.pop();
    this.currStack.push(+(a == b));
  } else if (instruction == "!") {
    this.currStack.push(+ !this.currStack.pop());
  } else if (instruction == "?") {
    this.currStack.push(Math.random());
  } else if (instruction == "n") {
    output = "" + this.currStack.pop();
  } else if (instruction == "o") {
    output = String.fromCharCode(this.currStack.pop());
  } else if (instruction == "r") {
    var input = this.program.io.getNumber();
    this.currStack.push(input);
  } else if (instruction == "i") {
    var input = this.program.io.getChar();
    this.currStack.push(input);
  } else if (instruction == "(") {
    this.length -= Math.floor(this.currStack.pop());
    this.length = Math.max(this.length, 0);
  } else if (instruction == ")") {
    this.length += Math.floor(this.currStack.pop());
    this.length = Math.min(this.length, this.code.length);
  } else if (instruction == "w") {
    this.wait = this.currStack.pop();
  }
  // Any unrecognized character is a no-op
  if (this.ip >= this.length) {
    // We've swallowed the IP, so this snake dies
    this.alive = false;
    this.program.snakesLiving--;
  } else {
    // Increment IP and loop if appropriate
    this.ip = (this.ip + 1) % this.length;
  }
  return output;
}
Snake.prototype.getHighlightedCode = function() {
  var result = "";
  for (var i = 0; i < this.code.length; i++) {
    if (i == this.length) {
      result += '';
    }
    if (i == this.ip) {
      if (this.wait > 0) {
        result += '';
      } else {
        result += '';
      }
      result += escapeEntities(this.code.charAt(i)) + '';
    } else {
      result += escapeEntities(this.code.charAt(i));
    }
  }
  if (this.length < this.code.length) {
    result += '';
  }
  return result;
}

// Define Program class
function Program(source, speed, io) {
  this.sharedStack = new Stack();
  this.snakes = source.split(/\r?\n/).map(function(snakeCode) {
    var snake = new Snake(snakeCode);
    snake.program = this;
    snake.sharedStack = this.sharedStack;
    return snake;
  }.bind(this));
  this.snakesLiving = this.snakes.length;
  this.io = io;
  this.speed = speed || 10;
  this.halting = false;
}
Program.prototype.run = function() {
  this.step();
  if (this.snakesLiving) {
    this.timeout = window.setTimeout(this.run.bind(this), 1000 / this.speed);
  }
}
Program.prototype.step = function() {
   for (var s = 0; s < this.snakes.length; s++) {
    var output = this.snakes[s].step();
    if (output) {
      this.io.print(output);
    }
  }
  this.io.displaySource(this.snakes.map(function (snake) {
      return snake.getHighlightedCode();
    }).join("
"));
 }
Program.prototype.halt = function() {
  window.clearTimeout(this.timeout);
}

var ioFunctions = {
  print: function (item) {
    var stdout = document.getElementById('stdout');
    stdout.value += "" + item;
  },
  getChar: function () {
    if (inputData) {
      var inputChar = inputData[0];
      inputData = inputData.slice(1);
      result = inputChar.charCodeAt(0);
    } else {
      result = -1;
    }
    var stdinDisplay = document.getElementById('stdin-display');
    stdinDisplay.innerHTML = escapeEntities(inputData);
    return result;
  },
  getNumber: function () {
    while (inputData && (inputData[0] < "0" || "9" < inputData[0])) {
      inputData = inputData.slice(1);
    }
    if (inputData) {
      var inputNumber = inputData.match(/\d+/)[0];
      inputData = inputData.slice(inputNumber.length);
      result = +inputNumber;
    } else {
      result = -1;
    }
    var stdinDisplay = document.getElementById('stdin-display');
    stdinDisplay.innerHTML = escapeEntities(inputData);
    return result;
  },
  displaySource: function (formattedCode) {
    var sourceDisplay = document.getElementById('source-display');
    sourceDisplay.innerHTML = formattedCode;
  }
};
var program = null;
var inputData = null;
function showEditor() {
  var source = document.getElementById('source'),
    sourceDisplayWrapper = document.getElementById('source-display-wrapper'),
    stdin = document.getElementById('stdin'),
    stdinDisplayWrapper = document.getElementById('stdin-display-wrapper');

  source.style.display = "block";
  stdin.style.display = "block";
  sourceDisplayWrapper.style.display = "none";
  stdinDisplayWrapper.style.display = "none";

  source.focus();
}
function hideEditor() {
  var source = document.getElementById('source'),
    sourceDisplay = document.getElementById('source-display'),
    sourceDisplayWrapper = document.getElementById('source-display-wrapper'),
    stdin = document.getElementById('stdin'),
    stdinDisplay = document.getElementById('stdin-display'),
    stdinDisplayWrapper = document.getElementById('stdin-display-wrapper');

  source.style.display = "none";
  stdin.style.display = "none";
  sourceDisplayWrapper.style.display = "block";
  stdinDisplayWrapper.style.display = "block";

  var sourceHeight = getComputedStyle(source).height,
    stdinHeight = getComputedStyle(stdin).height;
  sourceDisplayWrapper.style.minHeight = sourceHeight;
  sourceDisplayWrapper.style.maxHeight = sourceHeight;
  stdinDisplayWrapper.style.minHeight = stdinHeight;
  stdinDisplayWrapper.style.maxHeight = stdinHeight;
  sourceDisplay.textContent = source.value;
  stdinDisplay.textContent = stdin.value;
}
function escapeEntities(input) {
  return input.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
}
function resetProgram() {
  var stdout = document.getElementById('stdout');
  stdout.value = null;
  if (program !== null) {
    program.halt();
  }
  program = null;
  inputData = null;
  showEditor();
}
function initProgram() {
  var source = document.getElementById('source'),
    stepsPerSecond = document.getElementById('steps-per-second'),
    stdin = document.getElementById('stdin');
  program = new Program(source.value, +stepsPerSecond.innerHTML, ioFunctions);
  hideEditor();
  inputData = stdin.value;
}
function runBtnClick() {
  if (program === null || program.snakesLiving == 0) {
    resetProgram();
    initProgram();
  } else {
    program.halt();
    var stepsPerSecond = document.getElementById('steps-per-second');
    program.speed = +stepsPerSecond.innerHTML;
  }
  program.run();
}
function stepBtnClick() {
  if (program === null) {
    initProgram();
  } else {
    program.halt();
  }
  program.step();
}
function sourceDisplayClick() {
  resetProgram();
}
.container {
    width: 100%;
}
.so-box {
    font-family:'Helvetica Neue', Arial, sans-serif;
    font-weight: bold;
    color: #fff;
    text-align: center;
    padding: .3em .7em;
    font-size: 1em;
    line-height: 1.1;
    border: 1px solid #c47b07;
    -webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3), 0 2px 0 rgba(255, 255, 255, 0.15) inset;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
    background: #f88912;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3), 0 2px 0 rgba(255, 255, 255, 0.15) inset;
}
.control {
    display: inline-block;
    border-radius: 6px;
    float: left;
    margin-right: 25px;
    cursor: pointer;
}
.option {
    padding: 10px 20px;
    margin-right: 25px;
    float: left;
}
h1 {
    text-align: center;
    font-family: Georgia, 'Times New Roman', serif;
}
a {
    text-decoration: none;
}
input, textarea {
    box-sizing: border-box;
}
textarea {
    display: block;
    white-space: pre;
    overflow: auto;
    height: 50px;
    width: 100%;
    max-width: 100%;
    min-height: 25px;
}
span[contenteditable] {
    padding: 2px 6px;
    background: #cc7801;
    color: #fff;
}
#stdout-container, #stdin-container {
    height: auto;
    padding: 6px 0;
}
#reset {
    float: right;
}
#source-display-wrapper , #stdin-display-wrapper{
    display: none;
    width: 100%;
    height: 100%;
    overflow: auto;
    border: 1px solid black;
    box-sizing: border-box;
}
#source-display , #stdin-display{
    font-family: monospace;
    white-space: pre;
    padding: 2px;
}
.activeToken {
    background: #f93;
}
.nextActiveToken {
    background: #bbb;
}
.swallowedCode{
    color: #999;
}
.clearfix:after {
    content:".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
.clearfix {
    display: inline-block;
}
* html .clearfix {
    height: 1%;
}
.clearfix {
    display: block;
}

<textarea id="source" placeholder="Enter your program here" wrap="off">r.*.n!(</textarea>

<textarea id="stdin" placeholder="Input" wrap="off">1</textarea>

<input type="button" id="run" class="control so-box" value="Run" onclick="runBtnClick()" /><input type="button" id="pause" class="control so-box" value="Pause" onclick="program.halt()" /><input type="button" id="step" class="control so-box" value="Step" onclick="stepBtnClick()" /><input type="button" id="reset" class="control so-box" value="Reset" onclick="resetProgram()" />

<textarea id="stdout" placeholder="Output" wrap="off" readonly></textarea>

Steps per Second:
20

Previous two-snake solution:
rm1(
S.n.!(

Snake 1
r reads a number from input; m moves it to the shared stack. Then 1( causes the snake to eat its instruction pointer and die.
Snake 2
S switches to the shared stack. .n duplicates the value and outputs it as a number. .!( duplicates again, logically negates, and eats that many characters. If the number was 0, this eats one character, killing the second snake and ending the program. If the number was 1, this eats zero characters and execution loops back to the beginning of the snake, repeating indefinitely.

Did you just post the source code for an interpreter with the answer? Why not link to it?

@Cyoce The interpreter was written as part of Helka Homba's stack snippet challenge. Per his own statement, "the point is to make something that can be easily copied and used in future PPCG questions and answers." The fact that it was done here means that Helka's plan worked perfectly. :)

Acc! - 54 50 48 49 Bytes
N
Write _
Count q while _-48 {
Write _
}

Works in Acc!! too! ;)

AutoHotkey, 20 bytes
I recently got into AutoHotkey and have been waiting for a suitable challenge to try my skills at.
$0::Send 0
1::Send

This takes input by listening for key presses and outputs via simulated key presses. The $ on the first line forces the first hotkey to take input through the keyboard only, so it just outputs 0 when the 0 key is pressed. The second is not so lucky though. When it detects the 1 key being pressed, it presses the 1 key, which it detects, so it presses 1, which it detects and so on. AutoHotkey unfortunately doesn't like this, but that can probably be fixed by adding #HotkeysInterval 1 to the top of the program. I am not brave enough to try this though, as it will probably crash my computer.
If input and output through key presses is invalid, here's a solution that avoids it:
InputBox, a
MsgBox %a%
While a{
MsgBox 1
}

This is the first answer I've seen in AutoHotkey. Have a +1

Woefully, 266 bytes
First answer in this language!
It's called woefully because the bytecounts are saddening
Woefully is a 2d language with no conditionals, except for the notz/bool command (pop a, push 1 if not zero, else push zero), and combining this with the move char pointer command yields control flow. In a truth machine, the values entered are already zero or one, and are only of two values, so is less complex than some other conditional programs, which kind of defeats the purpose of the truth machine :P
There are two pointers, the instruction pointer (ip), and the char pointer (cp), and it's hard to explain in one post, but the ip goes through the paths, cp stays stationary unless moved by instructions the ip executes.
Woefully has 2 stacks, all pushing is to A, except dupe and AtoB
| || ||||| |
|| |||||| |
||| |||| |
|||| || |
||||| || |
||||| ||| |
||||| |||| |
||||| ||||| |
||||| |||||| |
||||| |
|||||| |
||||||| |
|||||| |
||||| |
|||| |
||| |
|| |
| |
|| |
||| |
||| |
|||| |
||| |
|| |
| |
| |
| |
| |
| |
|| |
||| |
|||| |
||||| |
|||||| |

Try it online!
Explanation (difficult from the size) Execution starts at the v, at the A path:
V   FI    \/  V shows initial char pointer pos, F the pos after movement
|A||X|||||Z|   if input is zero, I if it is 1. The path marked by \/ won't
||A||||||Z|    be executed until the first part has been done, and then only
|||A||||Z|  #X path halts program                          if input is zero
||||A||Z|   # A path pushes input     #Z path pushes one
|||||A||O|
|||||E|||O|
|||||E||||O|   #E path dupes, by peeking top of a stack, pushing to b stack
|||||E|||||O| #O path outputs TOS of A
|||||E||||||O|
|||||E|    ^End of path, go back to char pointer, still over this path
||||||F|      #F path pops a, moves the char pointer
|||||||F|
||||||G|
|||||G|
||||G|
|||G|      #G path pushes 4
||G|
|G|
||H|   #H pops a, moves char pointer by a. the char pointer is (again)
|||H|  #now over F or I, depending on input
|||X|  X are nops
||||X|
|||L|   L path pushes 1
||L|
|L|
|V| V path multiplies both TOS (A and B), pushes to A
|V|
|V|
|V|
||O|
|||O|    O path outputs tos of A
||||O|
|||||O|
||||||O|
End of path, go back to the char pointer. If input was zero, the char
pointer will be over the halting path, so program over, otherwise it's over
the next char, and goes to the infinite one river

Note this is somewhat simplified: paths overlap on the corners they meet at.

Pyramid Scheme, 166 156 131 123 bytes
Saved 10 bytes thanks to Pavel! Saved 25 33 bytes thanks to Khuldraeseth na'Barya!
   ^       ^
  / \     / \
 /set\   /do \
^-----^ ^-----^
-    ^- -^   / \
    /l\ /#\ /out\
   /ine\---^-----
   -----   -

Try it online!
Try it online!
Old answer and explanation (functionally equivalent)
    ^        ^
   / \      / \
  /set\    /do \
 ^-----^  ^-----^
/a\   /#\/a\   / \
---  ^------  /out\
    /l\      ^-----
   /ine\    /a\
   -----    ---

Hehe. I love this language.
Explanation
There are two pyramid chains. The first is:
    ^
   / \
  /set\
 ^-----^
/a\   /#\
---  ^---
    /l\
   /ine\
   -----

This sets variable a to line (a line read from STDIN), as a value (#).
The second:
    ^
   / \
  /do \
 ^-----^
/a\   / \
---  /out\
    ^-----
   /a\
   ---

This is a do while loop, with the left pyramid being the condition, and the right one being the body. Equivalent to:
do {
    out(a);
} while(a);

which is what we want.

You could make the line pyramid one size smaller right? Since it ignores if its broken up with line breaks?

@Pavel Yes, that's true

@ETHproductions okay, will do!

@ETHproductions Added explanation!

Using the sneaky nameless variable gets you down to 131

@Khuldraesethna'Barya I'm impressed! Thanks!

More savings :)

@Khuldraesethna'Barya That pyramid-chaining technique is really something!

Hehe. I also love this language.

I'm glad you enjoy it :D @Khuldraesethna'Barya

Groovy, 51 47 bytes
x=System.in.text as int;while(x)print x;print x

Radical.

That is nice how you're using the input. +1

Does Groovy have a do-while? IE do print x;while(x); (maybe needs braces)

@Justin No it doesn't sadly.

Funny that they don't list that in their list of major differences between Groovy and Java. I'd imagine this is a major difference.

you can save two bytes by not casting the input and doing an equality check to the string "1" - Try it online!

Vitsy, 10 5 4 Bytes
New Versions! :D
[DN]
[  ]    Repeat while the top item is not 0
 D      Duplicate the top item
  N     Print it out.

I would put a try it online link here, but Vitsy's try it online doesn't output every line as it is output yet.
Try it online!

That's quite a golf... is input initially laid in the stack?

@CᴏɴᴏʀO'Bʀɪᴇɴ Turns out I was a version ahead - forgot to push my changes - in any case, I'll add the flag as part of the byte count.

You forgot to push your changes? (Bad stack-related pun)

...ಠ_ಠ

The TIO link is broken :/

JavaScript, 32 bytes
x=prompt();do{alert(x)}while(+x)

On input of 0, alerts 0 to the user; on input of 1, forever alerts 1. If alert is not a suitable alternative for STDOUT, replace it with console.log and add 6 to the byte count.
Edit: I've been solidly beat by @intrepidcoder; see this answer.

Simplex v.0.8, 3 bytes
Try it here!
i¦o
i   ~~ take input
 ¦  ~~ repeat next character until zero byte met
  o ~~ output character

C, 39
main(){for(;putchar(getchar()&49)&1;);}

STDIN must be a 1-byte file. It will not work if there is a trailing newline. This is because the program relies on all calls to getchar following a 1 to return EOF, which is represented as -1 (all ones in binary).

QBasic, 23 bytes
INPUT x
1?x
IF x THEN 1

Gotos are the best way to loop. ;^) 1 is a label; ? is a shortcut for PRINT.

GOTOs are truely superior =D

Java, 149 128 120 bytes
class A{public static void main(String[]a)throws Exception{int n=System.in.read()%2;do System.out.print(n);while(n>0);}}

Why 120 bytes? Because Java.
Edit: Saved 21 bytes thanks to Justin. Saved 8 bytes thanks to dohaqatar7.

See: Java

Scanner s=new Scanner(System.in);int n=s.nextInt(); can be instead int n=new Scanner(System.in).nextInt();. At that point, get rid of the import and do int n=new java.util.Scanner(System.in).nextInt(); Leaves you with 128 chars

There's no need to use a scanner, just read from System.in directly. class A{public static void main(String[]a)throws Exception{int n=System.in.read()%2;do System.out.print(n);while(n>0);}} . You have to throw an Exception but it's shorter than all the crap with Scanner.

you could drop few charactrs if you use for(;;) loop instead do while

@user902383 Actually no, because then it would print 0's indefinitely too.  As it stands, it prints the 0 once, and 1 indefinitely, just as it should.

Prelude, 6 bytes
Prelude is a bit tricky here. The language specification says I/O is via characters' byte values. That's what the C implementation does. Then there's the Python interpreter, which uses bytes for input but prints decimal integers. And then there's my own fork of that interpreter which does both input and output numerically (which I've published a few months ago). Since languages on PPCG are defined by their implementations, all of these constitute valid Prelude variants.
My fork gives the shortest solution at 6 bytes:
?(1!)!

? pushes the input. (...) is a Brainfuck-style while loop, which is skipped for 0 input. Then ! prints the zero. If the input was 1, we enter the loop, push another 1 and print that with ! (we need to push a new 1, because ! pops the top of the stack).
Next up is the original Python interpreter at 14 bytes:
?6^+^+^+-(1!)!

Since output is the same as in my fork, all we need to do is map the character codes to 0 or 1 which we do by subtracting 48. There are several ways to get 48 in 7 bytes, but I don't think it's possible to do it in less. This one pushes 6 and then doubles it 3 times, by duplicating it with ^ and adding the two copies with +.
Finally, the solution that works with the original C interpreter needs 16 bytes:
?^(#^!^6^+^+^+-)

This one has a slightly different structure. Since we also need to output 48 or 49 respectively, we now remember the input and obtain the 0 or 1 only for the loop condition. This also let's us get a way with a single ! because we can easily turn the loop into do-while. Again, ? reads the input and ^ makes a copy which we only need because the first thing in the loop is #, which discards the top of the stack (we need this to discard the condition from a previous iteration). Now ^! prints a copy of the input. Then ^6^+^+^+- computes input - 48 as before. If that is 0, we leave the loop immediately and exit after printing a single number. Otherwise, the loop will keep going, printing the input 49 each time.

By "fork" do you mean you toggled the option on that one line?

@feersum I added it.

I was thinking of the NUMERIC_OUTPUT on line 5, but forgot it only affects one of I/O. I guess you had to add a numeric input option too for your modification.

@feersum yeah, exactly. The original Prelude interpreter already has the output flag set.

Retina, 9 7 bytes
/1/+>G`

Try it online!
Explanation
The stage G` itself is really a no-op (it's a Grep stage with an empty regex, which always matches). So it's all in the configuration. > prints the result of this stage (which is just the input) and /1/+ wraps it in a loop which runs as long as the string contains a 1. There's also implicit output at the end of the program. So we go through these two possibilities:

If the input is 0, the /1/ condition fails, so the loop is never run. Instead, the program terminates, and the 0 is printed at the end.
If the input is 1, the /1/ condition matches, so the loop gets executed. The loop iteration itself does nothing but print that 1, so the string's value won't change and the loop will continue indefinitely.

Whitespace, 46 37 bytes
Thanks to Kevin Cruijssen for golfing 1 byte off the first instruction, and 8 bytes by removing the last 2 instructions, which makes the program jumps to non-existent label and terminates with error but still output correctly in the output stream.
SS SL  # push 0
SLS    # dup
TLTT   # readn
TTT    # load
LSS L  # label L
SLS    #   dup
SLS    #   dup
TLST   #   prtn
LTS TL #   jmpz TL
LSL L  # jmp L

Demo on ideone
Previous safe version of the program which terminates normally has a proper label and the standard triple new line to end the program:
LSS TL # label TL
LLL    # end

Demo on ideone
Notation explanation:

# starts comment
L is newline
S is space
T is tab

I used this interpreter to develop the program and generate the comments.
Didn't expect the code to be this long. Whitespace requires the input to be read into heap, heap instructions consumes stack, printing instruction consumes the stack and even jump instruction consumes the stack, so it bloats the code with all the "duplicate top stack" instructions.

Is there anything wrong in my answer that warrants a downvote?

On this interpreter, SSL is a valid way to push 0 (which makes it as efficient as the duplicate instruction, heh). Also, LLL doesn't seem to be required to end execution there if it hits end-of-file. That would bring it down to 41 bytes.

I know it's been a while, but you can golf some parts: SS SSL (push 0) can be SS SL. After specifying it's positive with S (or negative with T), it's already implicit 0, so no need for an additional S for 0. In addition, you can remove the trailing LSSTL LLL. It will exit with an error (Undefined Label) for input 0, but that's allowed according to the meta. Try it online, or try it online raw 37 bytes.

@KevinCruijssen: Updated.

LaTeX, 97 bytes
\documentclass{proc}\begin{document}\typein[\q]{}\loop\typeout{\q}\ifnum\q=1\repeat\end{document}

I guess it's sort of a grey area since everything is generated at compile time. Prints 1s to "stdout" until it runs out of memory or one 0 depending on input.

Befunge-98, 7 bytes
&:.:j@#

Explanation:
&            Read integer
 :           Push copy
  .          Print the copy
   :         Push another copy
    j        Jump that many characters to the right
     q       Terminate program (jumped over if input was 1)
      #      Skip next instruction
             (And implicitly loop back to the start)

ResPlicate, 39 38 bytes
0 -49 12 1 48 9 0 49 4 2 0 49 4 2 48 0

This was one of the earliest examples I made after implementing this language, so I have simply copied it from the linked wiki article, which I largely wrote. Actually, having rewritten my old version to shorten it by a byte, I can now say this example was written for this catalogue.
ResPlicate in a Nutshell
Programs in ResPlicate are all comprised of a list of integers, which are inserted into a queue in order. Each step, the first two integers are popped as x and y. Then a list of x integers is popped (and padded with zeros if the queue had fewer than x elements) and re-enqueued y times. This is quite sufficient to ensure Turing-completeness. Indeed, it is even Turing-complete in the limited case that y is not allowed to exceed 2.
This simple language is extended with I/O in the following way: If x is zero and y is positive, y is output as a character. If x is zero and y is negative, a character is read from input, y+1 is added to it, and the result is enqueued.
Ungolfed:
Thus, the above program can be read like this:
0 -49                       Read a character from input, subtract 48 from its value.
                            If the input was 1 or 0, this will cause the corresponding
                            integer value to be pushed onto the queue.
12 1 [48 9 ... 48 0]        Move the next 12 integers to the end of the queue.
                            This brings the input integer to the front of the queue.

So now execution follows two completely different paths depending on the value of the input. If it was "0", it continues like this:
(0) 48                      The input zero and "48" are popped, causing the character
                            with value 48 ("0") to be printed.
9 0 [49 4 2 0 49 4 2 48 0]  Pop and discard the next 9 integers, emptying the queue.
                            An empty queue terminates the program.

If the input was "1", the program continues thusly:
(1) 48 [9]                  Enqueue 48 times the number 9.
0 [49]                      Print the character with value 49 ("1").
4 2 [0 49 4 2]              Place "0 49" (print "1") at the end of the queue,
                            followed by a copy of this command.
48 0 [9 9 ... 9 9]          Discard the 48 9's that were enqueued earlier.

At this point, the queue contains only "0 49 4 2 0 49 4 2", which will repeatedly print "1" and then restore the queue to precisely this state, ensuring that it will continue in this manner forever.

Marbelous, 22 bytes
00 .. ..
]] // ..
-O @1 ..
=O .. ..
+O /\ @1

All padding is superfluous in this program, spaces and dots can be removed.
The // sends the 00 marble through the ]] stdin device until there's a byte available, then it drops that byte. -O-O=0 or -O=O check for ascii 48 which is "0", then either the input gets output once or forever (through the @1 loop), incremented back up to the proper ascii value with a +O on the way out.

beeswax, 13 11 8 chars
I could golf the solution down by 3 more bytes. This solution is pretty much a literal translation of my Cardinal solution:
_T> "{'j

Explanation:
_         generate bee/IP
 T        enter integer, set lstack top value to this value
  >       redirect bee to right
    "     if lstack top value>0, skip next instruction
     {    output lstack top value to STDOUT
      '   if lstack top value=0, skip next instruction
       j  mirror bee direction along | axis

If 0 is entered, the following instructions get executed:
     +———————————————————————————— output '0'
     ↓
_T> "{'

After execution of ' the IP leaves the honeycomb and the program terminates.

And in case of entering 1:
      +——————————————————————————— mirror bee direction of movement (to the left)
      | +————————————————————————— output '1'
      | |  +—————————————————————— redirect bee to the right
      | |  |   +—————————————————— mirror bee direction of movement
      | |  |   | +———————————————— output '1'
      | |  |   | |  +————————————— redirect bee to the right
      ↓ ↓  ↓   ↓ ↓  ↓
_T> "'j'{" > "'j'{" > .......

... bouncing back and forth between > and j forever, printing an infinite string of ones.

Clone my beeswax interpreter (written in Julia), language specification and examples from my GitHub repository.

TrumpScript, 54 53 bytes
Say i
As long as,i is "1"?;:
Say i!
America is great.

The longer version:
Tell them what TrumpSaid
As long as , Cruz i is not number "1"?; :
Say what TrumpSaid !
America is great.

"Just think of debugging as a fun little game." lol

Just so you know this is a fork of the original TrumpScript for PPCG. https://github.com/samshadwell/TrumpScript

Befunge-93+, 7
&>:.:_@

& takes integer input. :.: is a palindromic loop: it duplicates the top of the stack, prints it, and duplicates it again. _ will exit the the loop by moving to the right if the top of the stack is 0. Otherwise it executes the loop again, then > executes the loop again, and so on until the stack overflows. @ terminates the program.

JAISBaL, 15 6 bytes
˗Y1˄N0

Explanation:
# \# enable verbose parsing #\
while               \# [0] start while loop #\
    printnumln 1    \# [1] print 1 #\
end                 \# [2] end current language construct #\
printnum 0          \# [3] print 0 #\

Sesos, 2 bytes
V0

Try it online! Check Debug to see the generated binary code.
How it works
The binary file above has been generated by assembling the following SASM code.
set numin  ; Switch to numeric input.
set numout ; Switch to numeric output.

get        ; Read an integer from STDIN and save in in the current cell.
nop        ; Set an entry marker.
    put    ; Print the integer in the current cell.
           ; (implicit jnz)
           ;     If the integer in the current cell is non-zero,
           ;     jump to the previous instruction.

Forte, 49 60 bytes
3LET5=5+(0*4)
4INPUT0:LET6=6-(0*4)
5PRINT0:LET3=3+(0*4)
6END

Try it online!
Forte is a weird and wonderful language with BASIC-like syntax and an execution model based on redefining integers. It has no conditional or looping constructs; to get conditional or looping behavior, you have to redefine the line numbers your program uses.
How?
Here's the code with better spacing:
3 LET 5=5+(0*4)
4 INPUT 0 : LET 6=6-(0*4)
5 PRINT 0 : LET 3=3+(0*4)
6 END

If the user inputs a zero to this program, the three LET statements don't change anything, and the program boils down to PRINT 0 : END.
If the user inputs a one... it gets interesting.
3 LET 5=5+(0*4)

The first time around, no numbers have been redefined yet; this line calculates 5+(0*4) and assigns that to 5. Nothing changes.
4 INPUT 0 : LET 6=6-(0*4)

INPUT 0 reads a number from the user and redefines 0 as that number. Suppose the user enters a 1. Every time 0, or a value of zero, occurs from now on, it will be changed to 1. For instance: LET 6=6-(0*4) now is calculated as LET 6=6-(1*4), which redefines 6 to be 2. This changes the END statement's line number to 2, which moves it out of the way of the program, allowing an infinite loop.
Redefinitions: 0->1; 6->2
5 PRINT 0 : LET 3=3+(0*4)

First, this line prints 1 (the value that 0 now represents). Then, 0*4 is now 1*4, so we have LET 3=7.
Redefinitions: 0->1; 6->2; 3->7
Next, we increment the instruction pointer and execute the command on line 3 7:
3 LET 5=5+(0*4)

which redefines 5 to be 5+4...
Redefinitions: 0->1; 6->2; 3->7; 5->9
... and we execute line 5 9:
5 PRINT 0 : LET 3=3+(0*4)

which should be read (with substitutions) as 9 PRINT 1 : LET 7=7+(1*4). We print another 1 and change 7 to 11, which means we execute the original line 3 again, and so forth.
For those who are still confused, read the Esolangs article or ping ais523 (the language's inventor!) in chat.

Brachylog, 4 bytes
Thanks to Fatalize for saving 1 byte.
w?1↰

Try it online!
Explanation
w     Write the input to STDOUT.
 ?1   Check whether the input equals 1.
   ↰  If so, recursively call the main predicate with 1 again.

What a pity that w's output isn't its input.

1+, 10 bytes
."#:[#":1#

Yay for comment abuse in a normal challenge (instead of a source-layout or polyglot one)! In 1+, the [ character that begins a comment is actually an instruction so it can be skipped with the goto command #.
For input 0:
.          Take input
 "#        Jump to the 0th hash tag
   ：      Output 0
    [      Comment the rest of the program out

For input 1:
.          Take input
 "#        Jump to the 1th hash tag
     #     The 1th hash tag
      ":   Duplicate and output
        1# Jump to the 1th hash tag

I can replace the 1 with " as well so that we get a 1+ program without a 1 instruction... Wow!
Naive solution, 14 bytes
.1##":"1+1<1+#

A simple do-while loop.

@petStorm No, [ is a block comment. It only comment everything else here because there's no ]. Also why did I suddenly get 4 upvotes on tips for golfing in 1+?

I could remove the [ because STDERR is ignored by default, but 1. This comment trick is really neat and 2. That's trivial

Google Forms, 3 sections + 1 question
Try it online!
Google Forms has two features which I believe make it qualify as a (very limited) programming language:

Multiple sections, which allow arbitrary rules for which sections redirect to which, allowing for uncontrolled infinite loops
The ability to make different responses to a question take the user to a different section upon clicking "next", allowing for input/conditionals, and controlling loops based on input

Google Forms also has a back button, which may make it possible to store arbitrarily large amounts of information, though there's no way to make use of that information without the human running the program doing something.

PowerShell, 24 Bytes
param($a)do{$a}while($a)

Gets variable $a, then uses the do-while loop functionality to output $a at least once, but continuing the loop if $a is truthy (i.e., 1).

Alternatively, using traditional while looping, also 24 bytes
param($a)while($a){$a}$a

In this instance, if $a is falsey, the while loop will never be executed and just the value of $a will be printed in the end statement. If $a is truthy, the program will enter the while loop and continuously print the value of $a.

Japt, 4 bytes
ÿ ©ß

As of 25 Oct 2016, I have implemented the recursion feature ß, which calls the entire program as a function. This is used here like so:
      // Implicit: U = input integer
ÿ     // Since there's no value to work on, use U here. Alert U and return it.
  ©   // If U is truthy (1),
   ß  //   run the program again with the same inputs.

Test it online!

Yay! We should hold competitions between Japt, , and Teascript to see which is the most effective JS-based lang.

@ןnɟuɐɯɹɐןoɯ That sounds great! But let's have at least another week to develop the langs; I've only worked on the Japt interpreter for ~8 hours and gotten ~2/3 of the features (all the easy ones) done. :-)

Sure! I could probably implement some improvements, too.

Just curious, is there a shorter way to do this in newer Japt versions?

@Flp.Tkc I've recently implemented the ÿ command, which alerts the value of an object and returns it, so I think Uÿ ©ßU should also work. I'll have to test it though.

@Flp.Tkc Actually, it can be Uÿ ©ß because ß implicitly uses the inputs as arguments. Thanks ;-)

Befunge-98, 16 bytes
&>:;#,1';#<_'0,@

Tested in pyfunge and BeQunge.
Simpler two-line version
&>:! |
@^,1']'0,

I like the previous one more, but this is what I came up with first.

I'm not 100% sure on my Befunge skills, but &:.jq>:.< appears to work, and is 9 bytes.

@Mego Damn. :-P

Whoops, looks like I missed a char. &::.jq>:.< for 10.

As @ThomasKwa pointed out in chat, &::.jq# works and is 7.

@Mego I'm not going to steal that. I'll let the inventor(s) post it.

It's been posted.

HP48's RPL, 22.5 bytes
« WHILE DUP REPEAT DUP END »

Since there is no such thing as STDIN or STDOUT on the HP48, the input is taken on the stack, and one "0" or an infinity of "1"s are pushed back on the stack.
If you try it, you will have to kill the program in order to see the "1"s since the stack is not refreshed while the program is running (Just press the "ON" button).
PS: The HP48's memory is made of 4 bits words, hence the non-integer bytes size

Prolog, 28 bytes
a(X):-write(X),X=0,!;a(X).

The cut ! is necessary to terminate the execution in the interpreter, otherwise it will wait to see if the user wants to get other answers.

No need for the extra parentheses! Saves 2 bytes.

@mat true. Not sure what I was thinking!

Turing Machine Code, 19 bytes
0 0 * * 1
0 * 1 r 0

Halts on 0 because there is no state 1.

Shakespeare Programming Language, 189 bytes
.
Ajax,.
Ford,.
Act I:.
Scene I:.
[Enter Ajax and Ford]
Ford:
Listen to thy heart.
Scene II:.
Ford:
Open thy heart.Is cat as big as you?If so, let us return to scene II.
[Exeunt]

Ungolfed:
The Construction of a Truth-Machine in Denmark.

Hamlet, the input.
Ophelia, who orders him around.

Act I: A truth-machine.

Scene I: In which Hamlet learns that all he needs, he can find in his heart.

[Enter Hamlet and Ophelia]

Ophelia:
  Listen to thy heart.

Scene II: In which Ophelia proclaims her doubts about Hamlet.

Ophelia:
  Open thy heart. Is my lover as fair as thee?
  If so, let us return to scene II.

[Exeunt]

I'm using drsam94's SPL compiler + GCC to compile this.
To test:
$ python splc.py tm.spl > tm.c
$ gcc tm.c -o tm.exe
$ echo 0 | ./tm
0
$ echo 1 | ./tm
1111111111111111111111111111111111111111111111...

Do you have the link for the Python implementation of SPL? looking to work on a JavaScript fork of it...

@WallyWest Here it is!

Deoxyribose, 18 bytes
Updated for the new v3 spec
ATGGAGAAGAGCATAAAT

Explanation:
ATG                         ATA (*)
GAG Glu     Dupe            TGG Trp     Power
AAG Lys     Pop             AGA Arg     Unipop
AGC Ser     Jump if <= 0    AGA Arg     Unipop
ATA *                       GCA Ala     Modulo
AAT Asn     Loop            TAA End

Execution starts at the initial ATG.
The top element of the main stack is duplicated & printed, then
If the value is less than or equal to zero, jump to the ATA formed by the Asn and the start codon (remember, the code is circular), then run through a series of no-ops, including printing some non-printable characters.
If the value is greater than 0, loop back to the start.

If you don't like the ugly sequence of no-ops, adding ATG to the end to make the loop target explicit results in a clean termination immediately after the jump, for three more bytes.

Deoxyribose 2, 21 bytes
ATGTGAGAAAAATCTAACTTA

Explanation:
ATG Start                           TAA Stop ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐
TGA Block size = 56               ┏ TGT Cys     Destination of Asn ┆
GAA Glu     Duplicate             ┃ GAG Glu     Duplicate          ┆
AAA Lys     Pop as int            ┃ AAA Lys     Pop as int         ┆
TCT Ser     If >= 0, jump to Thr ┐┞ AAT Asn     Jump back to Cys   ┆
AAC Asn     Jump back to Cys ────┼┘                                ┆
TTA                              └─ ACT Thr     Destination of Ser ┆
                                     └┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘

This is the first challenge on this site ever answered in this language (since it's only a week old), but I think it's a good showcase of what the language can do so I'll provide a bit of an explanation of what's going on. If you happen to be really interested, the spec, a Python-based interpreter, and additional (less golfed) examples are on GitHub.
Deoxyribose is a stack-based language with a small instruction set and a syntax based on DNA.
Execution takes place on a circular stretch of DNA, translating 3-digit "codons" into proteins, each of which corresponds to either

an operation on one or both of the stacks, or
a (perhaps conditional) jump to a particular sequence elsewhere in the code.

These jumps can lead to frameshifts, where the read head is moved a non-integer number of codons and the same bit of code ends up doing two totally different things at different times. The degenerate nature of the genetic code makes it possible (and fun!) to use this to your advantage.

I love this language concept!

brainfuck (portable), 29 28 bytes
>>>,.[[->+<<+>]>-]<+[<<]>[.]

Try it online!
(Improved by 1 byte thanks to Jo King, who found a terser way to start the [<<] loop.)
I know that on PPCG it's normally sufficient for an answer to work on one interpreter, but as this is a catalogue, I wanted a demonstration of a brainfuck answer that should work on any interpreter, and which exits without error on input 0. This program makes no assumptions about cell size, EOF behaviour, wrapping, tape extension to the left, etc. It's the shortest brainfuck truth-machine I'm aware of with these properties.
Explanation
>>>,.[[->+<<+>]>-]<+[<<]>[.]
>>>,                            Input a character to the fourth cell
    .                           Output that character
     [           ]              While the current cell is nonzero:
      [->+<<+>]                   Move the value to the next and previous cells
               >                  Make the next cell current
                -                 and decrement it
                  <+            Starting behind the current cell, at value 1
                    [<<]        Move back two cells at a time until we find zero
                        >[ ]    If the cell to the right is nonzero:
                          .       Output it forever

The basic idea here is to create a range on the tape, containing all values from the input's ASCII code down to 0. (So for example, if the input is 0, we get 48 in the third cell, 47 in the fourth cell, 46 in the fifth cell, etc..) Once we've done that, we look at alternate values of the range until we end up at a tape element before the start of the range. If the range has an even length (i.e. the input has an even ASCII code), we'll end up two cells to the left of it, so moving to the right we'll end up in a cell we've never written to (and thus still has the value zero). If the range has an odd length, we'll end up only one cell to its left, so >[.] will move to the first cell of the range (i.e. the user input) and output it in a loop forever.

PowerShell, 16 15 bytes
for(;$args){1}0

Try it Online!
Edit:
-1 byte thanks to @AdmBorkBork

Use a for loop to save a byte Try it online!

PUBERTY, 369 bytes
It is May 1, 2018, 3:01:04 PM.Y is in his bed, bored.His secret kink is J.Soon the following sounds become audible.oh yeah yeah yeah hrg fap yeah yeah yeah fap yeah fap yeah yeah mmf yeah yeah yeah hrg yeah hrg fap yeah yeah yeah yeah fap yeah fap yeah mmf yeah yeah yeah yeah yeah yes yeah yeah yeah yeah yeah hrg fap yeah fap yeah fap yeah yeah yeah yeah mmf yeah mmf

Ungolfed
It is May 1, 2018, 3:01:04 PM.
Yhprum is in his bed, bored.
His secret kink is humaninteraction.
Soon the following sounds become audible.

oh yeah yeah yeah
hrg
    fap yeah yeah yeah fap yeah fap yeah yeah
mmf

yeah yeah yeah

hrg
    yeah
    hrg
       fap yeah yeah yeah yeah fap yeah fap yeah
    mmf
    yeah yeah yeah yeah yeah

    yes

    yeah yeah yeah yeah yeah
    hrg
        fap yeah fap yeah fap yeah yeah yeah yeah
    mmf
    yeah
mmf

This was very much harder than I expected it to be using this language.
Explanation
PUBERTY is a wonderful language. It has 6 registers (A, B, C, D, E, F) and one register pointer, all initialized to 0. At the end of each instruction, REGPTR %= 6 and REG[REGPTR] %= 256.
These are the commands used in this program:

oh reads an ASCII character and stores its value into the current register
yeah increments REGPTR by 1
hrg...mmf loops until the current register has a value of zero
fap increments the current register by 1
yes prints the ASCII char corresponding to the value of the current register

The program starts with the header - the first four lines
It is May 1, 2018, 3:01:04 PM.

This sets $D to the Unix timestamp of the date % 256. In this case, we set it to 48. This statement is required
Yhprum is in his bed, bored.

This initializes $C to 6, the number of chars in the name, but we don't use this at all. This statement is required.
His secret kink is humaninteraction.

This line is where you declare all your kinks, if you want to learn about what they do, check out the esolang page since we don't use them here. This statement is required.
Soon the following sounds become audible.

Required line, does nothing.
oh yeah yeah yeah
hrg
    fap yeah yeah yeah fap yeah fap yeah yeah
mmf

yeah yeah yeah

read in a 0 or 1, then loop until $D is zero while incrementing $A and $B. This leaves us with $A containing ASCII value 0 or 1, depending on what was inputted and $B containing 208. Then move REGPTR back to A
hrg
    yeah
    hrg
       fap yeah yeah yeah yeah fap yeah fap yeah
    mmf
    yeah yeah yeah yeah yeah

    yes

In the inner loop, move REGPTR to $B (which  has the value 208) and loop until it is zero while incrementing $A and $F. This leaves us with $A containing 48 or 49 (the ASCII codes for 0 or 1) and F containing 48. Then print $A, which will output a 0 or 1 depending on which one was inputted.
    yeah yeah yeah yeah yeah
    hrg
        fap yeah fap yeah fap yeah yeah yeah yeah
    mmf
    yeah
mmf

Now we move REGPTR to $F and loop until that is zero while incrementing $A and $B. This leaves us with $A containing the ASCII value 0 or 1 and $B containing 208, just like it had at the start of the loop. The loop then exits if $A == 0 or loops infinitely if $A == 1.
This is my first codegolf answer so excuse any mistakes I made pls.

W s, 1 byte
The s flag forces a read from STDIN. This flag can be appended to the end of the command-line.
w

No, I didn't just make a built-in for the question.
Here is the expanded program (because w requires two inputs)
aaw

This decodes into:
mywhile(a[0],'a[0]',a)

Which means:
while a[0]:
    print(a[0])

The print is implicit in every while iteration. Since a[0] is always 1 once it is defined as 1, this will print 1 forever (the body is the same as the condition).
So you might say that this prints nothing if the input is 0. You are wrong, the w instruction returns the condition 0 after the while statement is done. Therefore it gets returned and gets outputted.
W s, 4 bytes
W was designed to be very powerful so that while loops are unneccecary. This program avoids this at the cost of being significantly longer. (Please don't use the while loop (which is simply for presentation purposes) in your W programs. Thank you.)
ibE&

Explanation
   & % Perform logical AND between the input and the code block.
     % If the input is 1, execute the following code block:
i E  %     Count to infinity,
 b   %     Printing the input in every iteration
     % Otherwise (part of the AND logic):
     %     Return 0, exit the program.

Shakespeare Programming Language, 123 120 bytes
(Whitespace added for readability)
T.Ajax,.Puck,.Act I:.Scene I:.[Exeunt][Enter Ajax and Puck]
Ajax:Listen tothy.Open heart.
     Am I worse you?If solet usAct I.

Try it online!
I make use of a trick to reuse Scene I. For some reason, it doesn’t error to keep taking input, so I do that. Then I just compare the input to zero, and loop if it’s greater. Saved 3 bytes by comparing to I instead of zero because characters initialize to zero—thanks Robin Ryder!

You can use Is I worse you? instead of Is zero worse you?, since all characters are implicitly initialized at 0.

True true, thank you!

Red, 28 bytes
func[a][until[prin a a = 0]]

Try it online!
Makes use of the fact that until will always execute its block at least once. The loop will only terminate if the argument passed to the function is 0, otherwise it will keep printing forever.

The loop will also terminate if you pass 0.0, 0%, $0, #"^(null)", 0:0, because it relies on the lax comparison. There's also ask for taking input from STDIN.

is there a consensus on how red/rebol function submissions should be made? this answer only seems to have the body.

Flipbit, 10 bytes
?>>>>>.[.]

Try it online!

Python 3, 35 34 bytes
def l(i):
 if i:print(i);l(int(i))

Older python 3.8 only code
i=input()
while i:print(i:=int(i))

Try me!
Explination:
While this ties the best python 3 answer thanks xnor for saving me a byte
This uses a few interesting properties to achieve what it does:

The input received is always a string when from a user input, thus the while-loop will start regardless if its a 1 or 0

Inside the loop, we print the number for the first time, and simultaneously using the walrus operator which was introduced in python 3.8, we assign the integer value to i. Using recursion, this code can now work in all versions of python 3, while it isn't a major improvement in bytes count, I'd still count making the code work in more versions an improvement!

Now, the value, if zero, is now converted from "0" to 0, meaning the loop will exit, otherwise if its 1, it keeps going!

I have tried hard to get lambdas to work, but every attempt ended up with more lines due to having to use recursion, if anyone has any ideas I am all ears! Meanwhile I will try to keep pushing this, the new version feels like it has more that can be pushed

Cute trick with the int. You can write while i: without parens saving a byte.

Dang, Thanks, One less byte means we are no longer tying haha

Hello Hell, 34 bytes
[+^-/>]!*/*/>[+^>][+-/<]-/<[{*+}/]

Try it Online!
The first program in my new language - Hello Hell! For information on the commands, memory model, etc. check out the repo.
Explanation:
[+^-/>]                             # Set the first 6 cells to 0
       !                            # Input
        */*/                        # Set the cell to 0 or 49 depending on input
            >[+^>]                  # Move to the 13th cell
                  [+-/<]-/<         # Set cells 8-13 to 0
                           [{*+} ]  # If 1, loop forever,
                                /   #  otherwise print 0

okay good I just wanted the upvoting to happen not the explaining thank you very cool

Desmos, 51 50 45 bytes
o→\left\{i=0:[0],join(1,o!)\right\}
i=0
o=0

Try It Online! (Click the play button on the ticker up top (metronome icon) to run the program)
Desmos doesn't exactly have standard I/O support, but this should get the point across. Input is the i variable, output is the o variable. Each line is a separate expression, and the first expression needs to be in the ticker, as shown in the TIO.
Addendum: at the very least, this output method is accepted by default. Not sure about the input.
EDIT: a surprising -1, apparently → parses properly as an action! Unfortunately, it still costs 3 bytes, which is the same as \to, BUT it allows me to change \to join to →join since the parser gets confused by \tojoin
EDIT: -5 thanks to zygan on discord who showed me that an action itself can be piecewise, and also me realizing that o! is shorter than o^o and doesn't even have to rely on wacky edge case behavior lol

44 bytes

Actually, even better: 39 bytes

@AidenChow wow! but i think +2, since it needs to be o=[0] in the initial state, with o=0 it wont let you run the ticker because it expects a list. still, i had no idea you could do lengthi

Oh oops, didn't notice that. In that case, change o.length to length(o) for 40 bytes.

33 bytes. I think this is about as low as it can get, unless I'm missing something.

@AidenChow you should post that, its significantly shorter than mine and uses a somewhat different approach methinks

Will do, I have posted my own answer.

Pure CPython 3.10 bytecode, 6 bytes
"Pure" means no constants and no names are allowed. As a result, the only method of input is by starting with values on the stack.
...and Python bytecode's only way to jump backwards (and therefore the only way to loop) uses "absolute" addressing, so my code assumes it is placed starting at instruction offset 3 (byte offset 6).
Hex of code: 04 00 46 00 70 03
Disassembly of code:
    >>    6 DUP_TOP
          8 PRINT_EXPR
         10 JUMP_IF_TRUE_OR_POP      3 (to 6)

Takes an integer on the stack. The easiest way to put 0 or 1 on the stack is:
          0 LOAD_ASSERTION_ERROR
          2 BUILD_TUPLE              X
          4 GET_LEN

Change X to 0 or 1. In hex, this is 4a 00 66 00 1e 00 (for 1) or 4a 00 66 01 1e 00 (for 0).
This will crash the interpreter for an input of 0 due to a buffer overflow. If this is not acceptable, add 2 bytes (append 53 00 (RETURN_VALUE)).
Attempt This Online! (0)
Attempt This Online! (1)

I'm going to use this opportunity to explain how CPython bytecode works. It's just an array of bytes, which are in opcode, oparg pairs.
For example, (hex) 01 02 03 04 is instruction_01(arg=02); instruction_03(arg=04).
The list of instructions is given in the documentation for the standard library dis module, although you sometimes need to dig about in Python's ceval.c to see exactly how they work.
In Python, bytecode is contained in a code object, which carries some metadata like source file lines, but the most important things are an array of constants (co_consts) and an array of names (co_names). In order to load a literal value, it must be loaded from co_consts; in order to lookup a global variable, its name must be in co_names. When I said I'm using "pure" bytecode, I mean that these arrays are both empty - so I can't use any literals (integers, strings, tuples, etc.), and I can't use any global variables, builtins, imports, or even look up any attributes. This allows an extremely minimal wrapper script (see the ATO link).
This leaves me with only PRINT_EXPR for output (or leaving a value on the stack), and no input at all other than taking a value already on the stack.
The truth machine is actually the easy part of this code, to be honest: it's essentially do { print x } while (x).
Loading an integer is a bit more involved: first I use LOAD_ASSERTION_ERROR to put a value on the stack. What value it is doesn't particularly matter, but this is one of only a few instructions I'm aware of that can load an object without any consts.
Then I use BUILD_TUPLE(1) to make the tuple (AssertionError,), and take its length with GET_LEN which is 1. To load 0 is a bit simpler: you only need
          0 BUILD_TUPLE              0
          2 GET_LEN

Although you can perfectly well leave the LOAD_ASSERTION_ERROR before that, to conveniently switch between loading 0 and 1.

Sidenote
GET_LEN is new in Python 3.10, so a historic method would have had to involve boolean <-> integer conversion, which is a bit more interesting IMO:
          0 LOAD_ASSERTION_ERROR
          2 DUP_TOP
          4 IS_OP                    0
          6 DUP_TOP
          8 BINARY_MULTIPLY
         10 PRINT_EXPR

This performs AssertionError is AssertionError, which is True. Then it does True * True to get the integer 1.
IS_OP(0) can be replaced with IS_OP(1) to do AssertionError is not AssertionError, which gives False, which gives 0.

Trilangle, 13 bytes
?!<(@^\<.#^)/

Try it on the online interpreter!
Unfolds to this:
    ?
   ! <
  ( @ ^
 \ < . #
^ ) / . .

As in every Trilangle program, control flow starts at the north corner heading southwest. \|/_ reflect control flow, while <^7>vL change the direction conditionally (depending on both the stored value and the direction of the IP).
The IP starts on the red path, where it encounters the following instructions:

?: Read an integer from STDIN
!: Write an integer to STDOUT (with trailing newline)
(: Decrement
\: Redirect control flow
<: Branch

Upon reaching the branch instruction, the number inputted will already have been outputted once, and the stored value will be one less than that: -1 if the input is 0, or 0 if the input is 1. The branch instruction proceeds left for negative values and right otherwise.
If the value inputted was 0, the program follows the green path, which immediately hits @ (end program). Otherwise, it follows the blue path:

/: Redirect control flow

): Increment, to cancel out the decrement instruction from earlier

^: Redirect control flow
(Walk off the edge of the board, and wrap around to the southeast corner)

.: No-op

#: Skip the next instruction

After encountering #, the IP jumps into the middle of the yellow loop. ! prints out the stored value (1) repeatedly, and the other two characters keep it in the loop.
<^ is not the only combination of control flow manipulators that works. I've found that at least the following pairs also work: <7, <v, <<, L>, ^>, >>. Interestingly, <\ causes it to print every odd number twice (1, 1, 3, 3, 5, 5, ...). All other pairs I've tried exhibit one of three behaviors:

Loop without hitting ! (e.g. L<)
Exit early, printing out finitely many numbers (e.g. <_)
Print a couple 1's before going back to the start and waiting for more input (e.g. <|)

CJam, 8 bytes
q~{_o}h;

There's no point in linking to the online interpreter, because that one doesn't like infinite loops.
This one works as well, printing newlines:
q~{_p}h;

Explanation
q~   e# Read and evaluate input.
{    e# While the top of the stack is truthy (i.e. 1.).
  _o e# Print a copy of the value on the stack.
}h
;    e# We only get here if the value was 0. If so, discard the other 0 on the stack.

Haskell, 38 35 bytes
main=interact x
x"1"=cycle"1"
x a=a

The input must not be terminated by a newline. This works for me: echo -n 1 | ./truth-machine.
Edit: thanks @Zgarb for 3 bytes.

One-liner (also 35 byte): main=interact(\x->[1,read x..1]>>x)

main=interact(\[c]->[c,'1'..c]) is 31 bytes.

MATLAB, 39 37 bytes
Two years later, two bytes golfed off.
disp(input('')),while ans disp(1),end

This was a bit shorter than the original one, since it avoid having anything after end, thus saving a comma or semicolon, and it saves one more byte by avoiding the separate call to disp(0).

Not sure if it worked for older versions of MATLAB but it surely doesn't work for R2019b. Because input('') is used as function parameter it's never saved to ans variable. It works fine for the Octave tho. And for that it can be even shorter: disp(input('')),while 1 disp(1)end works fine.

AppleScript, 93 Bytes
...this verbosity astounds me.
set a to(display dialog""default answer"")'s text returned
repeat while a="1"
log 1
end
log 0

TI-BASIC, 8 bytes
There are two programs that achieve 8 bytes:
Repeat not(Ans
Disp Ans
End

Repeat is TI-BASIC's do-until loop, so it doesn't check the condition the first time. The other way is recursion (name the program prgmT):
Disp Ans
If Ans
prgmT

Both take input from Ans; call using 0:prgmT or 1:prgmT.

TIL the TI-84 doesn't have tail-call optimization for recursive programs. :(

Minkolang, 7 bytes
nd$,N?.

Try it here. (DON'T click Run!)
Explanation
n     Take integer from input
d     Duplicate
$,    0 if 0, 1 otherwise
N     Output as integer
?.    Halt if 0, continue otherwise

This works because n pushes -1 if the input is empty...which is truthy! Also, Minkolang is toroidal so when the program counter moves off the right edge, it wraps around to the left edge and continues.

TeaScript, 21 16 bytes
TeaScript is JavaScript for golfing, created by user Vɪʜᴀɴ.
for(;alert×|x;);

The input is automatically stored in variable x. × (U+00D7 Multiplication Sign) is a shortcut for (x).
Try it in the online interpreter

See this line for an explanation of the bug behavior.

@ןnɟuɐɯɹɐןoɯ Ah, yes. That explains why whil(x) did the same thing, but not whi(x). Thanks!

Jasmin, 355 321 bytes
As with the other answers I've written in Jasmin, there isn't a whole lot of golf going on here. This code is (almost) exactly the code obtained from running javap on the class file generated by intrepidcoder's java submission. The one neat golfing trick I found was avoiding the usual .limit locals line by reusing local variable 0.
Some code golf four years later

Shorten the invocation of print by extending PrintStream
ldc 2 is shorter than iconst_2
Manipulating the stack with dup and swap is shorter than using locals variables with iload_0 and istore_0.

After these changes, the compiled class file needs to be executed with java -noverify.

.class L
.super java/io/PrintStream
.method public static main([Ljava/lang/String;)V
.limit stack 4
getstatic java/lang/System/out Ljava/io/PrintStream;
getstatic java/lang/System/in Ljava/io/InputStream;
invokevirtual java/io/InputStream/read()I
ldc 2
irem
dup2
invokevirtual L/print(I)V
dup
ifgt $-5
return
.end method

Would it be any shorter to put the code in an initializer block and not have a main method?

@feersum I've never been able to get static blocks to work using java version "1.8.0_60". I think static block are only accepted by  java in version 1.6 and earlier.  I don't have the correct version to test it so, I'll leave my answer as is for now.

+1 for golfing this 4 years later

, 6 chars / 11 bytes
↻ôï|ï;

Try it here (Firefox only).

Is the language name supposed to be "ESMin", or just five boxes?

ESMin in double-struck. It doesn't show up properly in some fonts, though... :(

Ah, okay. I can only see the double-struck letters ℂ, ℍ, ℕ, ℙ, ℚ, ℝ, and ℤ.

R, 29 27 bytes
2 bytes brilliantly saved by @Giuseppe
x=scan();while({cat(x);x})1

the other R solution isn't valid, but there's another two bytes you can squeeze out of this! click here to spoil it

@Giuseppe that is great.

Mathematica, 36 33 bytes
For[Print[i=Input[]],i>0,Print@i]

Mouse, 16 bytes
?0=[0!$](1^1!)$

Ungolfed:
? 0 = [           ~ Read a number from STDIN and test it for equality with 0
  0 ! $           ~ If equal, print 0 and exit
]
( 1 ^             ~ While true,
  1 !             ~ Print 1
)$                ~ End of program

PoGo, 10 bytes
ifpouftogo

Explanation:

if - accept numerical input and place the result into the current memory cell
po - add current position in code to the top of the po stack
uf - output the value in the current memory cell as a number
to - execute the following command only if the value in the current memory cell is >0
go - pop the most recent po location off the stack and jump there

The "po" stack is a call stack used for flow control.
The program in pseudo code:
read int x
do:
    print x
while x > 0

Labyrinth, 6 bytes
?|:!:/

In the case of a 0 input, this terminates with an error. For a beautiful solution which exits cleanly, see Sp3000's answer.
Since the code is linear, the instruction pointer will move back and forth on the code (it will turn around when hitting a dead end, executing the instruction at the end only once). So what is happening?
?  Read the input as an integer.
|  Compute the bitwise OR of the top two stack elements (there is an infinite supply of
   zeroes at the bottom). This is a no-op at this point.
:  Duplicate the input.
!  Print it as an integer.
:  Duplicate the input.
/  Divide the input by itself. If the input was 0, the interpreter will throw an error,
   polluting STDERR, but we can ignore that. STDOUT remains unchanged. If the input was
   1, then 1/1 just yields 1 again and execution continues leftwards.
:  Duplicate the 1.
!  Print it.
:  Duplicate the 1.
|  Bitwise OR between 1 and 1 gives 1.
?  Try reading another integer. But we're at EOF, so this pushes 0.
   We're in a dead end, so the IP turns around and moves back to the right.
|  Bitwise OR between 1 and 0 gives 1.
   At this point, the state is exactly the same, as the first time we hit |, so from here
   on it's an infinite loop, printing two 1s per iteration.

COMMAND.COM, 12 + 10 + 11 = 33 bytes
0.BAT:
@ECHO 0
@EXIT

1.BAT:
@ECHO 1
@1

Start COMMAND.COM with the above two files in the current directory. Then when it requests input, type either 0 or 1. Also works with CMD.EXE.
If you don't want the Microsoft version and copyright then you can use CMD /K ECHO OFF instead. I've therefore added 11 bytes for this, but subtracted 4 bytes, as you no longer need the @s at the start of each line.
If command-line arguments are acceptable and you are allowed use COMMAND /C 0 or COMMAND /C 1 then you can remove the @EXIT from 0.BAT. In that case the size is 7 + 11 + 1 + 1 = 20 bytes.

Haystack, 15 12 bytes
0io=v
  ^1?|

Still working on a oneliner (if it's possible).

Squirrel, 48 bytes
local a=stdin.readn('b')-48;do print(a) while(a)

Quipu, 20 bytes
\/1&
/\/\
1&??
>>
::

O, 12 11 6 bytes
j{.o}w
When 0 is inputted, 0 is outputted and the program ends. When 1 is inputted, 1 is outputted forever.
Explanation:

j     Get input as Number
{  }w While the input is 1
 .o    Print the 1
      Print the stack when code ends, which will only contain 0

Binary-Encoded Golfical, 11+1 (-x flag)= 12 bytes
Hexdump of binary encoding:
00 40 02 15 14 1B 1A 17 14 24 1D

Original image:

Magnified 125x, with color  labels:

Rough translation:
*p=readnum
lbl A
print *p
if *p!=0 goto A

Jolf
0 Bytes

I found out what to do with the zero-byte program! I made a truth machine.
0 as input
1 as input

Congrats, you have made the most boring answer on this challenge! ಠ_ಠ +1

@zyabin101 bows thank you.

This appears to be invalid as the second 1 seems to be a 3.

@Makonede It worked 5 years ago. Quite frankly I'm not sure what changed.

@ConorO'Brien Based on the JS code I figure it's just a bug. Still though, quite strange

@ConorO'Brien I kind of love that an app with literally no code used to work but now doesn't. Not really sure what you can do with that!

05AB1E, 5 bytes
Code:
Di[D?

Explanation:
D      # Duplicate input
 i     # If True (or 1), do
  [    # Infinite loop
   D   # Duplicate top of the stack
    ?  # Pop a, print a with no newline

Based on the date this was posted I assume implicit input wasn't a thing yet back then, but both D can be removed now to save 2 bytes.

Batch, 35 bytes
@IF %1==0 (exit)
:l
@echo 1&goto l

Please, anyone who can golf this more is more than welcome to.

-2 bytes by removing the parentheses from the if statement

Whenever, 72 bytes
From the webpage:

Introduction
Whenever is a programming language which has no sense of urgency. It does things whenever it feels like it, not in any sequence specified by the programmer.
Design Principles

Program code lines will always be executed, eventually (unless we decide we don't want them to be), but the order in which they are executed need not bear any resemblance to the order in which they are specified.
Variables? We don't even have flow control, we don't need no steenking variables!
Data structures? You have got to be kidding.

The official java interpreter doesn't seem to handle read() but the spec says it should work so.
1 -2,2#read();
2 defer(1) again(2) print("1");
3 defer(1||2) print("0");

The program works like this:

Initially 1, 2 and 3 are on the list but 2 and 3 must wait until 1 is gone.
When 1 is executed it removes 2 and then adds 2 back stdin times.  Therefore:

2 is only on the list if stdin was 1.
3 must wait until 2 is gone so it can only execute if stdin was 0.

If 2 is executed it will add itself to the list again and print '1'.
If 3 is executed (meaning 2 is not on the list) it will print '0'.
At this point we will be in one of two states:

2 will be on the list printing '1' and 3 will be perpetually waiting
1, 2 and 3 will all be gone and the program will end.

R, 16 28 25 bytes
x=scan();while(x)cat(1);0

Edited to read x

this isn't valid, because the 0 will be printed out with an additional [1]  preceding it, and the post states that the output must only be either a 0 followed by either one or no newline or space, or infinite 1s with each 1 followed by either one or no newline or space.

Scratch, 12 bytes

I love how Scratch can be so self-explanatory in the right contexts.

Your list name counts as bytes

Gaot++, 125 bytes
bleeeeeeeeeeet
bleeeet bleeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeeeeeet
bleeeeeeeeet
bleeeeeeeet

Compressed: 11e4e6e13e13e13e13e9e8e6e
Try it online!

Churro, 100 95 bytes
{========={o}{*}======}{*}======}{={*}{={o}{={o}{={*}{={o}{======={*}{==={*}{======={*}{===={*}

Explanation
Churro is a stack-based esolang where the only syntax element is, well, churros! Or rather, ASCII-art representations of churros. An example of such a churro is {o}====}.
In Churro, each churro has three characteristics:

Its orientation; whether it's facing left ({o}====}) or right ({===={o}).
Its filling; whether it's filled ({*}==}) or not ({o}==}).
Its tail length; the number of =s in the churro is the length of its tail.

Left-facing churros are integer literals; their tail length is their value, while their filling status is their sign. Filled churros are negative, while unfilled churros are positive.
Right-facing churros are operators; their tail length is which operator they represent, according to this table:
{{o}           pop A; discard A
{={o}          pop A, B; push B + A
{=={o}         pop A, B; push B - A
{==={o}        pop A; if A == 0, jump to churro after matching occurrence of {==={o}
{===={o}       pop A; if A != 0, jump to churro after matching occurrence of {==={o}
{====={o}      pop A, B; store B in memory location A
{======{o}     pop A; push the value in memory location A to stack
{======={o}    pop A; print A as an integer
{========{o}   pop A; print A as an ASCII character
{========={o}  read a single character from STDIN and push it to the stack
{=========={o} exit the program

Filled operator churros have the same behaviour, but peek at the stack instead of popping from it.
With that, here's the ungolfed, explained version of the Churro truth-machine:
{========={o}    read char from stdin
{*}======}       push -6
{*}======}       push -6
{={*}            push -6 + -6 = -12
{={o}            pop -6, -12; push -6 + -12 = -18
{={o}            pop -6, -18; push -6 + -18 = -24
{={*}            push input + -24
{={o}            pop -24, input + -24; push input + -48 (convert char to int)
{======={*}      print input as integer
{==={*}          if input == 0 jump to matching churro
{======={*}      print input as integer
{===={*}         if input != 0 jump back to matching churro

I'm using TheLastBanana's Haskell interpreter to interpret this. Installation instructions can be found there.
Finally, here's the "pure" version (no comments, line length 80, spaces between churros), as output by purify truth.ch:
{========={o} {*}======} {*}======} {={*} {={o} {={o} {={*} {={o} {======={*}
{==={*} {======={*} {===={*}

Saved 5 bytes thanks to Martin Ender!

And now I want a dulce de leche and some doughnuts...

dc, 13 12 bytes
?[pd1=@]ds@x

Run:
dc -f truth_machine.dc <<< "1"

Adding to the diversity of languages used, I present a dc solution that works as follows:
?              # reads the input and pushes it on top of the stack
[pd1=@]ds@x    # stores the macro command [pd1=@] into register '@' and executes it
   p           # prints the value on top of the stack
   d           # makes a duplicate that is pushed on top
   1=@         # pushes 1, pops two numbers and if they are equal, the macro from
               #register '@' is executed (again), thus making an infinite cycle

Moorhen 1 (or original creators version 1 here), 38 bytes
The original language creator has decided to add new instructions, which would change the existing ones. Hence, this language is in Moorhen version one
op pa id el pa id el ai op id ai pi ai

Note this doesn't print if input is 1, because printing only happens at halting, so it just puts infinite ones on stack
Explanation:
Commands can be (most of) all english words, and the command they execute depends on md5 hash mod 7. I used some length two words that corresponded to each of the seven commands
re: push 0
op: increment ToS
pa: decrement ToS
el: rotate stack (place ToS on BoS)
pi: dupe ToS
id: peek TOS, skip if it is non-zero
ai: flip pointer direction
there are two main segments of code
op pa id el pa id el

ai op id ai pi ai

op pa id el pa id el

This code, when run forwards, will have the pointer leave to the right side, with the initial value on the stack, minus one (0 -> -1, 1 -> 0). When run backwards, with [-1] as stack, it leaves the to the left side with [0] as the stack. When it leaves to the left, it will print the stack, items joined with spaces, so it will print 0. It uses "nops", commands that don't do anything under certain circumstances, or are a pair of inverses.
(the reason the comments look funny is because the interpreter ignores non-words, including real words that are hyphenated)
op pa                nop-when-running-forwards
      id el          nop-with-only-one-value-on-stack-and-running-forward
            pa       decrement-
               id el nop-with-only-one-value-on-stack-and-running-forward
                     [go to next part of code]

with all these nops forward, its essentially pa when running forward. However, backwards, with -1 on stack:
el                   nop-with-only-one-value-on-stack
   id pa             skip-pa,when-TOS-nonzero(-1,is-non-zero)
         el          nop-with-only-one-value-on-stack
            id pa    skip-pa,when-TOS-nonzero(-1,is-non-zero)
                  op increment-
                 [end,print-stack(with,-1,coming-in,print-0)]

With -1, backwards, it's essentially op (then implicit print)

The code that is at the right of that code:
ai op id ai pi ai

given -1, it will just reflect it back. Given 0, it will increment it, then enter a loop of duping ToS, which will be 1.
ai            reflect-pointer-direction-if-TOS-non-zero
   op         increment-
      id      skip-next-command-if-non-zero. This-command-skips-into-the-middle-of-a-loop:

        ai pi ai    this-is-the-loop. pointer-starts-on-pi,because-it-skipped-the-first-ai

           Here is a visualisation of how it executes
           pi       dupe-TOS (1)
              ai    reverse-if-ToS-is-nonzero (it is)
           pi       dupe-TOS (1) -again
        ai          reverse-if-ToS-is-nonzero (it is)
           pi       dupe-TOS (1) -again
           ...      this keeps happening

Zephyr, 41 bytes
input n
print n
while"1"=n
print n
repeat

Try it online!
A main design goal of Zephyr was that code should be readable and understandable. Looks like this holds true even when the code is maximally golfed. Mission accomplished.

Taxi, 617 bytes
Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to Crime Lab.1 is waiting at Writer's Depot.Go to Writer's Depot:s 1 r 1 l 2 l.Pickup a passenger going to Crime Lab.Go to Crime Lab:n 1 r 2 r 2 l.Switch to plan "z" if no one is waiting.Pickup a passenger going to Cyclone.Go to Cyclone:n 4 l 2 l.[r]Pickup a passenger going to Cyclone.Pickup a passenger going to Post Office.Go to Post Office:s 1 l 2 r 1 l.Go to Zoom Zoom:s 1 r 1 l 2 r.Go to Cyclone:w.Switch to plan "r".[z]0 is waiting at Writer's Depot.Go to Writer's Depot:n 4 l 2 l.Pickup a passenger going to Post Office.Go to Post Office:n 1 r 2 r 1 l.

Try it online!
There are shorter programs but they kept running out of gas. Here's the ungolfed version:
Go to Post Office: west 1st left 1st right 1st left.
Pickup a passenger going to Crime Lab.
1 is waiting at Writer's Depot.
Go to Writer's Depot: south 1st right 1st left 2nd left.
Pickup a passenger going to Crime Lab.
Go to Crime Lab: north 1st right 2nd right 2nd left.
Switch to plan "z" if no one is waiting.
Pickup a passenger going to Cyclone.
Go to Cyclone: north 4th left 2nd left.
[r]
Pickup a passenger going to Cyclone.
Pickup a passenger going to Post Office.
Go to Post Office: south 1st left 2nd right 1st left.
Go to Zoom Zoom: south 1st right 1st left 2nd right.
Go to Cyclone: west.
Switch to plan "r".
[z]
0 is waiting at Writer's Depot.
Go to Writer's Depot: north 4th left 2nd left.
Pickup a passenger going to Post Office.
Go to Post Office: north 1st right 2nd right 1st left.

Duck Duck Goose, 911 bytes
duck duck duck goose

duck

duck duck duck duck duck duck goose

duck

duck duck duck duck duck duck

duck duck duck duck duck duck duck duck duck duck duck goose

duck

duck duck duck duck duck duck duck duck

duck duck duck duck duck duck duck duck duck duck duck goose

duck duck

duck duck duck

duck duck duck duck goose

duck duck duck

duck duck

duck duck duck goose

duck

duck duck duck duck duck duck duck duck duck goose

duck duck

duck

duck duck duck duck duck duck duck duck duck duck duck goose

duck duck duck

duck duck

duck duck duck goose

duck

duck

duck duck duck duck duck duck duck duck duck goose

duck

duck duck duck duck duck duck duck duck duck duck goose

duck

duck duck duck

duck duck goose

duck duck duck

duck

duck duck goose

duck

duck goose

duck duck duck duck duck duck duck duck duck duck goose

duck

duck duck

duck duck goose

duck duck duck

duck goose

Includes 2 trailing newlines. I can't remove the newlines, they are instructions.

Thotpatrol, 311 219 bytes
Credit to @MickyT for shaving 92 bytes off
JACKING IN
DM THAUGHTY JO
  JO
  JO
❤PRIME ASSETS❤ JO INTERROGATE ©1©
  JO
INTERCEPT MALIGNANT COMMUNICATIONS
REPORT UNPATRIOTIC ACTIVITY

This is a fairly uninteresting truth machine the core structure is as follows:
input a
print a
while a == 1
    print a
end while

Here is a link to an implementation in Java:
https://github.com/MindyGalveston/thotpatrol-

what in the world is this language?

This language is a pet project of mine. Its core eccentricity is that there is a finite and non-accessible list of allowed variable names. The only way to programatically allocate data is by abusing string variables and using them as databases or trial and error automatic variable naming which does not have a hard upper complexity limit. Have fun, and I'd love to answer any questions!

How is this 318 bytes? It's 243 UTF-8 bytes, or 172 characters.

I forgot to update the code when I updated the byte count and the logic, You're completely right I made a mistake. Should be fixed now.

Also is Jo or Bo acceptable variable names?

This is what I was trying to say before about a slightly different structure

works perfectly! I updated the answer with your changes.

Dreaderef, 11 bytes
5*1 1 5?8-1

Takes input from the command-line arguments. Try it online!
Explanation
This program consists of eight numbers. These numbers are grouped into instructions; each instruction consists of a label, which is the first number, and zero or more arguments, which follow the label. Instructions with different labels can have different numbers of arguments, but the parsing of instructions happens at execution time (which allows self-modification). The numbers in the program are written to the tape from position 0 at the beginning of the program; each label and argument occupies its own cell, and the instruction pointer occupies the cell at location -1.
5 *
1 1  5
? 8 -1

Dreaderef's preprocessor allows you to write aliases that stand in for numbers representing instruction labels. Using aliases makes the program look like this:
0.   numo  *
2.   deref 1  5
5.   ?     8 -1

(The leading numbers are position labels and are treated as comments.) Before the program executes, * is replaced with the input integer.
0.   numo  *

The first instruction is numo, which outputs its argument (either 0 or 1) in decimal without a trailing newline.
2.   deref 1  5

deref reads the tape at the position indicated by its first argument. It then writes that value to the tape at the position indicated by its second argument. This means that here deref copies cell 1 (the input integer and argument to numo) to cell 5 (part of the next instruction).
5.   ?     8 -1

This instruction is interesting in that the label is dynamically generated by the previous instruction (? is an alias for 0 in Dreaderef, but it is intended to convey that a given cell is uninitialized and will not be read until it is written to). During execution, it will be set to either 1 or 0 depending on the input integer. Proceeding from here requires some knowledge about what labels map to what instructions:

The instruction with label 0 is end, which terminates execution.
The instruction with label 1 is deref.

If the input integer was 0, the end instruction causes the program to terminate, and the other two numbers are ignored.
If the input integer was 1, the instruction looks like this:
5.   deref 8 -1

Cell 8 is past the end of the program, meaning that its value defaults to 0. The 0 is copied into cell -1, which is Dreaderef's instruction pointer. This means that execution jumps back to position 0, which is the start of the program. Because * is read before execution of the program, the same input (1) is reused, and the program outputs and loops again.

Rockstar, 34 Bytes
Rockstar is a quite new computer programming language, designed for creating programs that are also song lyrics. Rockstar is heavily influenced by the lyrical conventions of 1980s hard rock and power ballads.
Listen to your heart
Say your heart
While your heart is not empty
Scream it

But yes, you are right, it's longer than 34 bytes, but so poetic, I couldn't resist get some lyrics in. You could even sing it!. Here's the golfed version:
Listen to X
Say X
While X
Say X

Which interpreter are you using? Wouldn't the input be treated as a string, which is truthy? Also, would the Until X loop until X is truthy, rather than while X is truthy?

@JoKing You are right, the golfed version was incorrect, I changed the Until loop to the While loop. (it did not change the code length).
To answer your question, I use my interpreter: https://github.com/gaborsch/rocky - that worked the expected way, too, so it was my mistake, not the interpreter's.

The input is numeric in this case, so 0 is coerced to false.

Malbolge, 257 bytes
(aONMLKJIHGFEDCBA@?>=<;:98765FD21dd!-,O*)y'&v5#"!DC|Qzf,*vutsrqpF!Clk|ih
gfed9(T&6KoOHZYXWVUTSRQPONM]KJIHGFEDCBA@?>=<;:9876"'~g|edybav_zyxwvotsrq
pSnPlOjibKfedcba`_XA??ZYRW:UTSLQ3ONMLK.IHGFE>CBA@?"=<;:38765432s0/.n,+*)
j!&%f{"!~}|_zyxZvYnsrqpRnmlkjML:f_^GF!

Try it online!
From esolangs.org
Quite the abomination, isn't it?
In fact, this language is so horrible, I don't think anyone "programmed" this in the traditional sense. If I'm remembering correctly, this was found by a search program that basically brute-forced for possible Malbolge programs that worked as a truth machine.

The program was made by esolang's Malbolge expert Malbranche, who is amazing and certainly can program it in other ways than brute force. You may be thinking of the first Malbolge "Hello, world!", which was indeed found by search.

Ah, yes. Thank you for the correction, it does make sense that a Hello World program would be much longer and more difficult.

Rust compiler (nightly), 86 bytes
#![feature(log_syntax)]macro_rules!t{(0)=>{log_syntax!{0}};(1)=>{log_syntax!{1}t!{1}}}

(playground)
Readable version:
#![feature(log_syntax)]

macro_rules! truth_machine {
    (0) => {
        log_syntax!(0);
    };
    (1) => {
        log_syntax!(1);
        truth_machine!(1);
    };
}

truth_machine!(0);
truth_machine!(1);

Explanation
As the only way to iterate over anything other than the inputs of a macro is recursion, an infinite loop will always end in a stack overflow. I'm considering this error message "constant output of your language's interpreter that cannot be suppressed," as there's no other way to "infinitely" loop. The time for this to occur is dependent on the stack size, and thus most real-world macros will attempt to perform multiple operations per iteration to avoid this. Since this takes more space, I didn't do this. The only ways for a macro to give output are:

compile_error!, a builtin which will immediately terminate compilation with a message, and is thus not valid for this challenge
log_syntax!, an unstable builtin which will print its input to the compiler's stdout, with a newline appended
Returning a value from the macro directly, which directly conflicts with the concept of an infinite loop

I chose to use log_syntax!, as I decided it was the only option that would follow the rules of the challenge. However, it requires a nightly compiler, and 23 additional characters in the source to enable. The syntax of macros is pretty fixed, but one trick I found is that macros called with macro!{} instead of macro!(); do not require a semicolon after, and are thus one character shorter.

Acrostic, 89 45 bytes
-44 bytes by running the initial input command backwards to output the zero (thanks Jo King for the idea!).
     R
DOUBLE
  N  A
PROVIDED
R
I
NIL
T
END
D

Try it online...? (This esolang has no official online interpreter; that link takes you to a repl.it link with my own unofficial Python interpreter loaded in, complete with the truth machine program. If I can find/make a more proper online interpreter, I'll link that instead.)
Acrostic is an esolang designed by Mercerenies for which programs take the form of crosswords, which are traversed word-by-word during program execution.
First, END is run backwards, which starts the program. PRINTED is then run backwards, which will take a numerical input and push it onto the stack. If the top of the stack is 0, the PROVIDED branch is not taken, and instead NIL is run (which does nothing). Because there are no other words to run from there, PRINTED is executed forwards, and then END is executed, ending the program. If, however, the top of the stack is nonzero, the PROVIDED branch is taken, READ is run backwards (outputting the number), DOUBLE is executed backwards (pushing -2), UNO is executed forwards (pushing 1), and PROVIDED is executed (because the top of the stack is nonzero), looping this section forever.
It took me much trial and error to get an Acrostic truth machine this short, though IMHO it is a very clean and compact example. If only this language were easier to golf...

Thanks for the idea about reusing the read to print the zero @JoKing, I have a 46-byte solution now that I'm playing around with.

Vyxal, 4, 3 bytes
-1 thanks to @Aaron Miller (uses implicit input for the 1s)
[{₴

Try it Online!

3 bytes

@AaronMiller fixed

Alternate 3 bytes

Plumber, 28 20 bytes
[]
=]]][=[]
  ][=[][

Try it Online!
I figured Plumber could use some love, so I thought I'd give it a try. It's a pretty fun language to work with! There's no online interpreter for it, so the TIO link is to Javascript, with the interpreter in the header, compliments of @RedwolfPrograms.
This simply takes in input, prints it, and if it is non-zero, it keeps printing it forever.

Brain-Flak, 6 bytes
{(())}

While the top of the stack is non-zero, push 1. Input to the stack is implicit, and output would also be, but if the program doesn't halt, nothing is outputted. However, one is continually pushed onto the stack, and it's the closest Brain-Flak can get to infinite output.
Try it online!

Perl -p, with the following restrictions ppencode, 15 bytes.

Use only keywords with lowercase alphabets only
Separate each of them with just a space

print while sin

Try it online!
How it works

sin(0) is zero
sin(1) is not zero
-p is for implicit I/O for line by line

Alternatives
sin can be replaced with one of following keywords:
abs int oct hex

can you do print while-$_?

@JoKing if I had changed the restriction.

Oh, i don't know how I missed that oops

ErrLess, 12 10 bytes
Thanks to Aaroneous Miller for saving 2 bytes
q@#@8*1-[.

No newlines/spaces.
Explanation
q     { Input a number a number, `n` }
@#    { Output `n` }
@8*1- { Push `8*n-1` to stack (7 for 1, -1 for 0) }
[     { Jump backwards by that many instructions }
      { Goes to right after input for 7, just before halt for -1 }
.     { Halt }

ErrLess is a stack-based language I made for fun over the last few months. You can read the docs here, and I also started a tutorial.
Try it online!

10 bytes: q@#@8*1-[. It could be 8 bytes with q@#@5*[., but hitting [ or ] with a 0 goes into an endless loop, since it doesn't move the pointer. Not sure if that is intentional or not.

Also, this is a really neat looking language! Just so you know, you could check out pythonanywhere.com to host your Python interpreter online. I use it for my languages, and it's also used for Vyxal and Rattle.

@AaroneousMiller The endless loop thing is intentional, just another edgecase you have to constantly keep track of, or else your program breaks... I'll check out pythonanywhere, thx!

lol, I love it!

8 bytes by terminating with an error (lol) q@#@2$]]

@MannyQueen It's not supposed to do that D:
Now the question is: if I fix the interpreter, can I still use your solution? I'm not entirely sure...

Unlambda, 15 bytes
``c``@?1i `c`|i

Try it online!

This sent me down a bit of a rabbit hole of Unlambda. What a wild language!

@Mayube mission successful ;)

Brainfuck, 27 25 23 bytes
,.[-[->>]<++<]>>>[+[.]]

I ran it here (Uses negative cells, get around this by adding  a << to the beginning)
I used modulus 2 instead of subtracting 48 to differentiate 0 and 1 which cuts down some characters. I also copied and did modulus at the same time.
Old answers:
,.[->+>+<<]>[-[<<]>[.]>-]

,.[->+>+<<]>[-[>>]>[.]<<<-]

Site is no longer available (also, i think you mean adding a >> to the beginning to avoid negative cells). You can save a byte by doing [+.-] instead

StupidStackLanguage, 5 bytes
htxux

Try it online!

Piet + ascii-piet, 12 bytes (2×6=12 codels)
tavnsJ dl jj

Try Piet online!
As a grid:
tavnsj
 dl jj

As an image:

There was an existing answer with 12 codels, but I got this independently. Any smaller image size is likely not possible, though ascii-piet encoding allows to omit trailing black cells on each line (which makes the linked answer 11 bytes) and therefore may allow for a bit more optimization.
How it works
If the input is 1:

      InN        [1]
Loop: DP+        []   (rotate right once)
      OutN       []   (stack underflow, ignored)
      Push1      [1]
      Dup        [1 1]
      Goto Loop
      DP+        [1]  (rotate right once)
      OutN       []   (print 1)
      Push1      [1]
      Dup        [1 1]
      Goto Loop ...

If the input is 0:

InN    [0]
DP+    []   (go straight through)
Push1  [1]
Not    [0]
OutN   []   (print 0)
HALT

K (ngn/k), 13 bytes
{x}{ \x}/.1:0

(Don't) Try it online!
The web interpreter does support stdin (via a popup prompt), and entering a 0 will print a single 0. But entering a 1 will hang the entire tab.
We need an unbounded loop, which means either m m/ or a recursive function. The latter being {x o/ \x}@.1:0 is 1 byte longer than the above.
{x}{ \x}/.1:0  full program
          1:0  read stdin as a single list of bytes (= single string)
         .     eval it
{ }{   }/      while loop:
 x               while the value is truthy,
     \x          debug-print the value (print with newline) and return it unchanged

If the input is 0, the loop runs zero times and the resulting value 0 is implicitly printed. If the input is 1, the loop runs forever, printing 1\n repeatedly.

an ATO link is useful for showing output: {x}{ \x}/.1:0

also, {x}( \)/.1:0 seems to work

Pip, 5 bytes
WaPaa

In pseudocode:
while(a)
    print(a)
autoprint(a)

a is the first command-line argument. (The OP commented on the sandbox post that this was an acceptable way to take input, even though Pip is capable of taking input from stdin.)

WaPaa. I love these weird types of languages because when you put them into TTS programs they have a conniption.

tinylisp, 36 bytes
This is a language that I'm basing an upcoming challenge on. The spec in the challenge doesn't include the disp function, but the reference implementation does.
(d M(q((x)(i x(i(disp x)0(M x))0))))

Defines a function M that takes an argument x (the closest that the language has to input). If x is falsey, we return 0, which is printed. If x is truthy, we want to display x and then recurse. There isn't any equivalent to Common Lisp's progn in the language, so the best way to do this is to use the disp call as the condition of an if. The result is falsey, thus putting the recursive call (M x) in the else branch.

Sisi, 22 bytes
Sisi doesn't have any way to take user input, so the number is expected to be stored in the variable x (presumably on line 1).
2 print x
3 jumpif x 2

Pretty straightforward: print the number, and keep doing so as long as it's 1.

Beam, 25 23 13 bytes
rSn(`)>@<
H@<

Try it in the online interpreter! (Warning: it may crash your browser with an input other than 0.)
Beam is a 2D language, based on the concept of a beam of light moving through the 2D source code. Beam is oriented around two main memory values: one held by the beam, and one called the "store". Here are the commands used, in order:

r - Set the beam to the next ASCII code in the input. (48 for 0, 49 for 1)
S - Set the store to the beam.
n - If beam != store, point the beam downward. Does nothing the first time.
( and ) - If store != 0, point the beam right/left, respectively.
` - Decrement the store by 1.

Now, the beam enters (`) from the left, and bounces back and forth until the store reaches 0. If the store's initial value is 48 (0), it will exit to the left, traveling through these chars:

n - If beam != store, point the beam downward. This time, since the beam is 48 and the store is 0, it does its job.
< - Unconditionally point the beam to the left.
@ - Output the beam as an ASCII character. Prints 0.
H - Halt the program.

However, if the store's initial value is 49 (1), it exits the loop to the right, and runs through this code:

> - Unconditionally point the beam to the right.
@ - Output the beam as an ASCII character. Prints 1.
< - Unconditionally point the beam to the left.
@ - Output the beam as an ASCII character. Prints 1.
> ...

...and so on until the end of time (or until your browser crashes).
Thanks to @MickyT for this awesome layout!
P.S. If you want to learn more about Beam, check out and vote on this post!

+1 I like it, didn't think I could shorten it, but here's a slightly shorter version.  2 Lines rSn(\)>@<andH@<` for 13

@MickyT Holy cow, that's brilliant! I'll update in a sec

Self-modifying Brainfuck, 30 19 bytes
Similar method to my BF answer. Input and print, subtract the 0 (the source's last byte) from the input, so cell is 0 or 1. Loop printing if input cell is 1. Tested on my Python interpreter.
,.<[->-<]>[<<.>>]10

You can also run it on TIO.

JavaScript (ES6), 77 73 64 61 bytes
x=prompt()==1;j=a=>{if(x)setTimeout(j,9);console.log(+x)};j()

This program doesn't crash your web browser!
Explanation:
x = prompt() == 1;             // this makes sure input is 1 or not while defining
j = a => {                     // es6 arrow function
  if (x)                        // if x is 1
    setTimeout(j, 9);            // make sure to do this function again in 9ms
  console.log(+x);              // log the number
};
j();                           // call j

Better version: x=prompt()==1;j=()=>{if(x)requestAnimationFrame(j);console.log(x?1:0)};j()

Even better, replace j=()=> with j=a=>

Actually, using x=prompt(); is shorter, but you have an x==1?1:0 that could just be x. That leaves x=prompt();j=a=>{if(x==1)requestAnimationFrame(j);console.log(x)};j() at 69 bytes. However, instead of using requestAnimationFrame you could use a setTimeout, which is shorter and leads to x=prompt();j=a=>{if(x==1)setTimeout(j,10);console.log(x)};j() at 69. Oh crap! That would mean that JS beats Stack! D:

Haha. The reason I use x==1?1:0 is so that if the user inputs "true" it counts as 0.

(oh my, it's liam4! hey!) But you don't need to. The only inputs needed 1 and 0.

Great work! I think +x will work in place of x?1:0.

Stuck, 9 Bytes
Stuck has a while loop function (which I never added to the docs on Esolangs, but it has existed for a little over 2 months) which makes this possible. It wasn't before this as far as I know :P.
ip"1="'ph

Dammit I was trying to make a truth machine in Stuck but couldn't figure out how to do it without a while loop

@quartata Sorry about that :P Whenever I get enough free time I will update the documentation.

Brainfuck, 54 bytes
+++[>++++[>++++<-]<-]>>>,.[>+<<[>>-<<-]>>>+<<-]>[>.<]

Explanation:
+++[>++++[>++++<-]<-]>>> Set a register to 48 (ASCII 0), using multiplication to reduce the byte count (3*4*4), then set the pointer to the next instruction
,. Receive and print a line of input
[>+<<[>>-<<-]>>>+<<-]Set the next register to be a numerical value, and the one after to represent the ascii output value
> Move the data pointer to the numerical register
[>.<] While the numerical register is not 0, print the ascii register

I already have a shorter BF program, but just so you know, 48 can be made shorter. See this helpful page.

Thanks. Yeah, I didn't see your program before I posted mine, must have missed it when scrolling through.

Try running the code snippet contained in the question.

brainfuck, 20 bytes
,[.>+<-[-[>]<++<-]>]

This requires an interpreter that exits with an error upon stepping out of bounds with < (such as this one). Stepping over the left edge in case of an even value was the easiest way I found to do a parity test. I wouldn't be surprised if it could be a couple of bytes shorter.

Julia, 51 45 bytes
readline()>"0"?while 2>1 print(1)end:print(0)

Read a string from STDIN. If it's lexicographically larger than the string "0" then print 1 forever, otherwise print 0 and we're done.
Saved 6 bytes thanks to Sp3000!

Batch, 44 bytes
@set/p n=
:a
@echo %n%
@if %n%==1 goto :a

Explanation

set /p reads from stdin into a variable
:a is a GOTO marker, because batch does not have while loops

The rest should be obvious: output the variable n and if n is 1, repeat.

Common Lisp, 30
(do((x(read)))((=(print x)0)))

Common Lisp's print function returns the object that was printed.
This reads a value from the user, then prints the value until the return value of the call to print returns 0.

 VBA, 54 48 Bytes
Sub f(u):Do:Debug.Print u:Loop While u>0:End Sub

Look Guys, VBA can fit on one line(almost) and be hard(ish) to read like all the other Languages.
Debug.Print could be Msgbox but I feel that isn't the Spirit of the challenge and you really don't want Never ending pop-ups
Old Code
Sub f(u):Do:Debug.Print u:If u=0 Then End
Loop:End Sub

Using ActiveSheet.Range("A1") as your input and running in the Immediate Window, you can reduce to 31 bytes: ?[A1]:Do Until[A1]=0:?[A1]:Loop

For sure. Any of my VBA answers are designed not to run in immediate and do not use sheets. VBA can for sure be shortened by using those methods and I encourage you to explore the possibilities. But at the time there were few to no VBA responses so I limited myself to Subs only.

FORTH, 44 bytes 39 bytes 31 bytes
Edit:
As suggested by @Nate Eldredge, we can shorten the code, if we allow extra spaces in the output. This program is 31 bytes long:
: P BEGIN DUP . ?DUP 0= UNTIL ;

Sample run:
1 P
0 P

First version:
: P BEGIN DUP 48 + EMIT ?DUP 0= UNTIL ;

Sample run:
1 P
0 P

Explanation:
We expect the value 'b' of 0 or 1 on the stack.

: P       -- beginning a word P                          ( b )
BEGIN     -- starting a loop                             ( b )
DUP 48 +  -- creating an ASCII code for the character    ( b  b+48 )
EMIT      -- echoing the character                       ( b )
?DUP      -- dup'ing the value if non-zero               ( 1  1 ) or ( 0 )
0=        -- testing if the value is zero                ( 1 FALSE) or ( TRUE )
UNTIL     -- end of the loop if true                     ( 1 ) or ( - )
;         -- finishing the word

If I take the challenge seriously, FORTH has Standard I/O capabilities, but it is natural in FORTH to take the input from the stack.
If I use the STDIO feature, the code looks like this (44 bytes)
: P KEY BEGIN DUP EMIT DUP 48 = UNTIL DROP ;

Sample run:
P

(Note, that in my environment the standard input was buggy)

My FORTH is rusty, but wouldn't it be easier and shorter to use . instead of 48 + EMIT?

@NateEldredge . puts an extra space after the number, otherwise it's OK. I've read in some answers that it may be acceptable. If that's the case we can shorten the code. I'll update the answer.

MIPS asm, 24 bytes
main:
li $v0, 5  # load read int
syscall  # exec read int, stores value in $v0
move $a0, $v0  # store in $a0
li $v0, 1  # load print int
loop:
syscall  # print $a0
bgtz $a0, loop  # loop while $a0 is greater than zero

Had to learn MIPS recently, might as well do something fun with it.

C, 35 chars
main(c){for(gets(&c);c%puts(&c););}

This is even hackier than cbojar's solution, from which I copied the abuse of the parameter c (int used as char[4]), along with the reliance on little-endian.
puts returns a non-negatve number on success, which (on my Linux/gcc4.8.2) happens to be the number of bytes printed, which happens to be 2. c%2 tests if c is odd, which is true for '1' and false for '0'.

O, 14 bytes
i{1{1o1}w}{0o}?

O is a work-in-progress language with loads of commands and an interpreter written in "APL-style C", which means incomprehensible code.
i     Get input as String
{     Start a CodeBlock (like ruby)
1    Push 1 to the stack
{    Start a CodeBlock
1   Push 1 to the stack
o   Pop the stack and print it
1   Push 1 to the stack
}    Push the CodeBlock to the stack
w    Do the CodeBlock on the top of the stack while the value under it is true. (Pops them both.)
}     Push the CodeBlock to the stack
{     Start a CodeBlock
0    Push 0 to the stack
o    Pop the stack and print it
}     Push the CodeBlock to the stack
?     If the 3rd down value in the stack is truthy, do the CodeBlock 2nd down in the stack, otherwise do the CodeBlock on the top. (Pops the first 3 values on the stack.)

"APL-style C" - you mean nightmares?

@Mego yep, pretty much

I think you're being unfair to APL.

@ThomasKwa it's a direct quote.

@Hipe that is horrible. must it be golfed?

Marbelous, 23
This version doesn't terminate after the zero is printed, but that should be alright:
..}0
../\//
>0
}0
+O
+O

Old version:
}0@0
\\
../\+O
>0\/+O
@0

It doesn't add a newline between each 1, but whatevs.

You need to terminate if your language is at all capable of terminating.

Python 2- 64 bytes
x=input()
if x==0:print"0"
elif x==1:
 while True: print"1"

A trick you can exploit in Python is that 0 is the same as False and anything but 0, including 1, is True. This generally holds in most programming languages

PowerShell, 24 bytes
'for(){1}'*"$args"+0|iex

Generate expression as string and pass it to Invoke-Expression (eval).
It casts $args array to string with "", then multiplication sign casts it to int and string for(){1} is repeated int times (1 or 0 - empty string). Then we add 0 to this string, which will be cast to a string also.
Resulting string expression (for(){1}0 or 0) is then piped to Invoke-Expression, resulting either in endless loop outputting 1 or one-time output of 0.

MATL, 4 bytes
`GtD

Relevant MATL features *
To explain the code, the following MATL features need to be presented first.

` ...] is a "do ...while" loop. The top of the stack is consumed at the end of each iteration, and used to decide whether to go on with a new iteration or not. The last ] can be omitted if it's at the end of the program (loops are implicitly closed).
G works as follows:

When there has been no user-input it does nothing;
When there has been one user-input it pushes it onto the stack
When there has been more than one user-input it takes a numeric argrument and pushes one of those user-inputs onto the stack

t by default duplicates the top element of the stack
D by default displays the top element of the stack, and consumes it.
If a function requires more inputs than currently are in the stack, user-input is implicitly triggered. The entered elements are placed below the current bottom of the stack.

Code explanation
` enters the loop. At the first iteration, G does nothing. t implicitly asks for user input and duplicates it. D displays and consumes the duplicate, leaving the original input on the stack. If this input is 0 the loop is exited and the program finishes (a single 0 has been displayed). If the input is 1, control goes to the beginning of the loop again. Now G pastes the input, t duplicates it, D displays and consumes that duplicate, and again there's a 1 to be used as loop condition, so the loop begins again, indefinitely (an infinite number of 1 is displayed).

 * at the time of writing. The behaviour of G has changed since then: G now triggers implicit input when there has been no user-input yet. However, this doesn't affect the code, which works the same. The only difference is that in the first iteration the implicit input is now triggered by G,  not by t.

Detour, 2 bytes
,~

Try it online!
, will print a value then push it to the next cell.
~ is a filter, so it will push a value IFF it is greater than 0.
Cells wrap around the edges.

Java, 87 bytes
interface A{static void main(String[]a){System.out.print(a[0]);main(a[0].split("0"));}}

(has output to STDERR, but that should not matter)

I'm not entirely sure if this is valid. The rules state that the program must infinitely run unless killed or out of memory. This will cause a stack overflow, since Java doesn't have tail call recursion optimization.

Yes, for the standard JVM; but there the size of the stack depends on the memory allocated. If the memory allocated by -Xss is large enough, it will run arbitrarily long (see also https://stackoverflow.com/questions/4734108/what-is-the-maximum-depth-of-the-java-call-stack). The stack overflow therefore is just the visible result of the program being out of memory.

Fair enough, I didn't consider -Xss. Upvoted, and welcome to PPCG!

Thanks. I'm not sure, but might there exist even some other JavaVMs that handle this more efficiently?

I'm not aware of any JVM implementations that do tail call recursion optimization. I know Oracle HotSpot doesn't, and I doubt Excelsior does.

Program arguments are not STDIN!

@SeanBean "take input from STDIN or an acceptable alternative" - command-line arguments are an acceptable input method.

The boring thing about challenges like this is there is really only one good answer per language. You can't get shorter than this which is really boring... I downvoted

maybe downvote the challenge if you don't like it, instead of this particular Java answer? Not that I mind but you could reach a larger audience there... downvoting because you believe an answer is the shortest kind of defeats the purpose of codegolf??

A stack overflow is a form of memory outage: there is no more place in the stack memory for another stack frame.

HALT, 49 bytes
1 IF '0' 2 ELSE 3
2 TYPE '0';HALT
3 TYPE '1';SET 1

Pretty simple. If input is one go to 3, output 1, set the pointer to 1 so the program never ends. If input is output 0, print, then halt.
Online interpreter (Firefox only)

such amazing much wow where's rightgoat

@Seadrus ---I ate him---. I mean, he'll be coming soon

No he won't, you're the only goat left ;)

Lua, 56 52 Bytes
I know that this answer in 70 Bytes exists, but its author doesn't look like he's updating it when someone point out an improvement.
if io.read'*n'>0then::a::print"1"goto a end print"0"

Old 56 bytes solution
if io.read()=="1"then while""do print"1"end end print"0"

Nothing special here, just using the fact that "" evaluates to true to save a byte on the infinite loop. Parenthesis for functions parameters aren't mandatory when they only take a single string, which is not stored in a variable.

Shtriped, 33 bytes
e :
t :
.
 d :
 i :
 p :
 .
.
p :

This prints the 0 or the infinite stream of 1's without any trailing newlines or spaces.
Explanation:
e :  \ initialize a variable named ":"
t :  \ prompt for integer input, storing the result in :
.    \ define a function named "." that will only return if : is 0 (the next 4 indented lines are part the function)
 d : \ decrement : if : is positive, else return immediately
 i : \ : must have been 1 to reach here and was just decremented, so increment back to 1
 p : \ print :, which we know is 1
 .   \ recursively call ., endlessly looping
.    \ call . initially
p :  \ if . terminated this line will finally be run, printing : which we know is 0

BASTARD, 83 bytes
{{fi in 0{!b {= {t 0} ‘1’} {(o <> {{fi out ‘1’}{o}}){o}}{fi out ‘0’}}}}

Note: This language is not qualified. Mostly because I'm still designing it. I just wanted to test drive it against some puzzles.
Explanation:
fi in copies the input into the 0 place on the Variable Stack.
!b is a basic if statement to check if its a "1" or not.
If it is, we just use fi out to print our "0".
Otherwise, we define a new function called o that prints a "1", and then calls itself again.

Welcome to Programming Puzzles and Code Golf Stack Exchange. This is a great first answer, +1. Your language looks interesting; once you've got enough reputation you could get help developing it on Chat.

NTFJ, 27 bytes
:*:##~~~~~#@|########@|($~^

An online interpreter can be found here.
NTFJ is an esoteric programming language, made by user @ConorO'Brien, that is intended to be a Turing tarpit. It is stack-based, and pushes bits to the stack, which can be later coalesced to an 8-bit number.

The only pushable values are 0 with ~ and 1 with #.
The only manipulations possible to the actual values of the stack are to wrap eight bits into a byte with @, and to NAND with |.
The only logic command is IF with (), but combined with JUMP ^, it can be used to create loops.

Thus, it's quite difficult to manipulate values to do your bidding.
How it works
                               Implicit input: byte 48 for 0 or 49 for 1.
:*:                            Duplicate the top item, pop/output, and duplicate again.
   ##~~~~~#@|                  Push 193 and perform NAND.
             ########@|        Push 255 and perform NAND.
                               These two operations change 48 to 0 and 49 to 1.
                       (       If the top item is not 0:
                        $       Pop the top item.
                         ~^     Push 0 and jump to that instruction.
                               This effectively creates a while loop that loops the entire program.

I believe removing the last paren should still work.

@CᴏɴᴏʀO'Bʀɪᴇɴ Thanks, it does!

Beatnik, 26 bytes
J ZD ZD JA K ZZZZJ Z JJ MF

Try it online
An explanation
Words    Scores   Action
J        8        Get character value from input
ZD       12       Duplicate TOS
ZD       12       Duplicate TOS
JA       9        Output TOS character
K ZZZZJ  5 48     Push 48 (char 0) onto stack
z        10       Pop 2 from stack and subtract
JJ MF    16 (7)   If not zero skip back 7 words

Of course something like the following, while still not making sense, looks more like what you would expect for a Beatnik program.
Shall falsey determine truths? We **WithoutAWarningAboutMemoryUse** printed infinitely yeas!

The last one mostly makes sense, except for He quackpizzled? :)

@ETHproductions Yea, try to find a word that is SORTAWORDLIKEWITHABIGNUMBER and still fits gets difficult :)  Will have a play and see what I can come up with.

@ETHproductions  That's a bit better now

UGL, 6 bytes
il$o:o

Try it online!
How it works:
i       #stack.push(input)
 l  :   #while stack.peek():
  $     #    stack.dup()
   o    #    print(stack.pop())
      o #print(stack.pop())

WistfulC, 141 bytes
This C has seen better days.
if only int n were 0...
wish for "%d",&n upon a star
someday !n... wish "1" upon a star
*sigh*
wish "0" upon a star
if wishes were horses...

Obviously not competitive, but then neither is this language.
Rough translation to regular C:
int n = 0;
scanf("%d", &n);
while (n) {
    puts("1");
}
puts("0");
exit(0);

Silicon, 3 bytes
I[]

Explanation:
I          Get input
[          While the top of the stack is 1
           Implicit output
]          End while
           Implicit output

MarioLang, 25 bytes
   >:<
   "==
 ;[!:
===#=

Why is this non-competing? Just FYI: "Non-competing" generally means "Uses language features that are newer than the challenge" or "Used to be valid but the rules changed".

I mean that I am not using this code to win this challenge. but upvotes are free!

That's not what non-competing means here. Also, this answer predates yours and is a lot shorter.

@Dennis You're correct.

@DrGreenEggsandIronMan I was just aware that there was a shorter one and said "non-competing".

PHP, 34 bytes
<?for($f=fgetc(STDIN);$f;?>1<?)?>0

Wanted to try to get rid of the print but not sure it's worth it since you have to reintroduce the <? tags

T-SQL 23 bytes
No STDIN here so a hard-coded variable.
DECLARE @ INT =1; or DECLARE @ INT =0;
and the truth machine is
l:PRINT @ IF(1=@)GOTO l

Java, 143 141 125 88 bytes
interface T {static void main(String[]a){System.out.print(a[0]);main(a[0].split("0"));}}

Ungolfed Test Code
interface T {

    static void main(String[] a) {
        System.out.print(a[0]);
        main(a[0].split("0"));
    }
}

That's 143 characters.

Why did you even check?

I'm using a userscript for PPCG, and it tells me how many bytes there are. (You should totally use it, it's worth it)

Ahh ok. It's shorter now anyway :P

C, 41, 40 bytes
main(c){for(c=getchar();putchar(c)&1;);}

Reads a single character from stdin, writes to stdout.
This version is 1 byte longer than feersum's solution, but removes his/her assumptions onstdin.

Would putchar(c)&1 work?

Yes, you are right! One byte saved, thanks @Dennis.

Lua, 34 Bytes
repeat print(arg[2])until arg[2]<1

arg[2] contains the first command line argument, (arg[1] contains the filename)
Give an input through the command line, and it shall spam it if it's 1, or once if it's not.
Simple enough.

Brainfuck, 5 Bytes
,.[.]

I/O is as 0x00 / 0x01 bytes.
I just think it's a neat thing.

Copy, 67 59 bytes
My new esolang :D
getch a
add b a
add b -48
print a
skip b
skip 1
copy -4 0 1

Explanation:
getch a     Take input in variable 'a'
add b a     Set 'b' to 'a'
add b -48   Substract 48 from 'b'
print a     Print 'a'
skip b      Skip the copy if 'a' is not zero
skip 1      ^
copy -4 0 1 Copy the code block from the print to this instruction after this instruction

protip: *subtract

@DestructibleWatermelon No

Crystal, 48 37 36 bytes
y=gets;y=="0\n"&&(p 0;exit);y=="1\n"&&loop{p 1}
y=gets;y=="0\n"&&(p 0;exit);loop{p 1}
y=gets;y=="0\n"&&(p 0;1/0);loop{p 1}
Edit: Shaved off 10 bytes because the post doesn't specify what should happen on invalid input (like 2). If it does and I misunderstood, let me know.
Edit: Shaved off 1 byte by dying with an error instead of normal exit.
Crystal is statically typed, so I couldn't just do gets.chomp (gets can return nil, and nil doesn't have chomp). The alternative was gets.try &.chomp, but that takes much more space than just having the newlines.
In Crystal (and Ruby) you can do something like puts 0 if y=="0\n", however you can also shave off 2 bytes by doing y=="0\n"&&puts 0 as the && operator returns the last object it tests for truthiness.
loop is a method in the standard lib that infinitely runs the block. It's a much shorter way of writing while true;CODE;end.
p prints the result of .inspect on its arguments to the output. Here I abuse it as a shorter puts because for numbers it'll just return the number.

Valve scripting language, 38 bytes
alias 0 echo 0
alias 1 "echo 1;wait;1"

This defines two commands, 0 and 1. Type 0 into the console for the zero case, and 1 for the 1 case.

Could I just try this in half life's console, or do I need the source SDK?

@Pavel I tested it on the TF2 console, so that should be fine.

Underload, 16 bytes
((1)S:^)~^:^(0)S

Underload has no way to take input from standard input. The most natural way to take input is therefore from the initial stack: () for 1, (!()) for 0 (this is the normal way to represent numbers in Underload).
Here are Try It Online links for 0 and for 1 (be prepared to kill this one quickly; the infinite loop runs very quickly and will spam up your browser window).
This program didn't need much effort to golf; the most idiomatic way to do things is almost the shortest (I just had to be careful not to let the input get buried too far on the stack). It's easiest to read if I translate the code to a hypothetical functional language:

function x(y)
    print(1)
    x(x)
end
x = x^(input)
x(x)
print(0)

The only weird thing happening here is being able to exponentiate functions, but it's a fairly easy-to-understand operation; for example, raising a function f to the power 3 would produce f compose f compose f, i.e. lambda x.f(f(f(x))). Raising a function to the power 1 does nothing (just like if you'd raised an integer to the power 1); and raising a function to the power 0 gives you the identity function (just like raising a number to the power 0 gives you 1). Actually, the integers in Underload are defined in terms of their effect exponentiating functions, rather than the other way round; the operation is fundamental enough to Underload that you use it to construct most flow control.

Jelly, 3 bytes
Ṅ¹¿

If reading from STDIN is absolutely required:
ƈOḂṄ¹¿`

I'm not sure which since "Jelly's main input method is via command line arguments, although reading input from STDIN is also possible."

Your second version can also be ƓṄ¹¿, where it reads a line instead of a single character.

SmileBASIC, 23 22 bytes
INPUT N@L?N?N/N
GOTO@L

Ends the program with a divide by 0 error.
If this isn't allowed, here's a 23 byte solution:
INPUT N@L?N
IF N GOTO@L

BitCycle, 7 bytes
Golfed 4 bytes off my example program!
?~<
!~+

Provide input as 0 or 1 on the command-line. The -s or -p debug options are recommended, especially when dealing with infinite output.
Explanation
BitCycle is a 2D language that works by moving bits around a playfield. Commands used in this program are:

? puts input bit(s) onto the playfield, moving east
~ duplicates and negates a bit, turning the original right and the negated copy left
< sends bits westward
+ turns 1-bits right and 0-bits left
! outputs bits

The input hits the first ~. A negated copy turns left (north) off the playfield and is discarded. The original bit turns right (south).
At the second ~, the original bit turns west into the ! and is output. A negated copy turns east.
If the original bit was 0, the negated copy is 1; it turns south at the +, goes off the playfield, and is discarded.
If the original bit was 1, the negated copy is 0; it turns north at the + and then west at the <. The 0 hits the first ~ again, where it turns right (north) off the playfield and is discarded. The negated copy (1) turns left (south), leading to an infinite loop.

Alternative 7 byter ?v~ newline !~+

WireWorld (It doesnt have a scoring method yet :\)
 ████ █ <= this pixel will be the input. if it is a electron head (1),
█    █     It will loop forever as 1. if its a wire (0), it will do nothing.
█ ██ █
 ██ █
  ██

Aceto, 11 10 bytes
X
p|1
rip^

reads a string and converts it to an integer. | tests for truthiness (1 is truthy, 0 is not) and mirrors horizontally if truthy (in that case moving to the 1). Otherwise, we'll go to 0, which pushes the 0, we print implicit zero and eXit.
If the number was truthy (e.g. 1), we got mirrored to the 1, which pushes a 1, prints, and goes one cell up (^), going into an infinite loop.

MarioLANG, 11 bytes
;>:[<
=====

Explanation:
;        Get numerical input and save in current cell
 >       Move left (Required to make an infinite loop)
  :      Output the current cell
   [     Skip next command if cell is 0
    <    Move right

Basically, it loops infinitely unless input = 0

Wise, 3 bytes
[:]

Try it online!
Wise cannot actually output whenever you want, it only outputs the entire stack when the program terminates. So the solution to infinitely output is to simply infinitely fill the stack. When the program eventually halts (never), it will output the stack that, at that theoretical point in time, will have infinite values in it.
Explanation
[:]  Implicit input from command-line arg
[    If last value is != 0..
 :   ..Duplicate last value on stack
  ]  If last value is != 0, jump back to [

Given a non-zero number, will infinitely duplicate the input on the stack, after an infinite amount of time, will terminate and output the entire stack.
Given zero, jumps to the end of the program and immediately terminates, outputting the stack, which contains only the input.

Ly, 7 bytes
n:u[:u]

Explanation:
n        # take input
 :u      # duplicate it and print it
   [     # while the top of the stack is not 0...
    :u   # duplicate it and print it
   ]     # end loop

With the current version on TIO, this works n[:u] since the 0 on the stack prints when it exits.

Python 2, 50 39 bytes
Don't know why nobody mentioned I could just write input()
i=input()
while(int(i)):print 1
print 0

Very simple, if the input is 1, will continuously print 1 and cannot reach the print 0. If it is 0, the while will never fire.
Try it online!

You can save a few bytes by using stdin instead of command line args.

29 bytes, you don't need to cast the input to an int because the input function in Python 2 does eval on the input before returning. You also don't need parentheses around the input call.

Oh, actually... This code doesn't even work. Theoretically, it would work if infinite 1's were given as input, but that doesn't meet the spec. Since while is calling the input function every time, it will just print one 1 and then reach the end of the input and error. Your earlier solution with command line args did work, or you can assign the input to a variable before looping.

@LyricLy yeah, I tried that once. Thanks!

Befunge, 4 bytes
&:.%

Try it online!
Please note: this answer is no longer valid with this particular interpreter. At the time of writing, the interpreter used had a quirk where trying to read more integers when there weren’t any would return the last integer. I believe that this was “fixed” in some interpreter update. (Thanks to @osuka_ for realizing that this answer no longer works)
Explanation:
&       Take number input
 :.     Duplicate and print input
   %    Mods the second from-the-top with the top number in the stack
        This means that if the top is 1, it will yield 0 % 1 = 0,
        But if it is a 0, it errors out and stops execution because you are
        trying to divide by 0

&       The program wraps back around if it didn't error, and the & takes
        the last number in the input if it has already taken them all, yielding
        the original 1 or 0

Coincidentally, this doesn't also work for /, because it strangely asks you what you want the answer to be.

The modulo trick is really clever. I love it.

This doesn't work - it prints -1 instead of 1 after the first time.

@osuka_ I think it’s due to the interpreter being updated, unfortunately. I remember it used to be that reading an end of feed with & would give the last integer again (which would make this print 1). I think they changed it so it gives -1 on an EOF instead. Thanks for letting me know

@MildlyMilquetoast No worries - The reason I stumbled upon this is that I was looking for other befunge answers, to see if anyone had already posted one identical (or very similar) to one I just wrote. I love the mod trick!

This can be fixed by adding two !s after the &

6502 machine code (C64), 17 bytes
20 FD AE 20 9E B7 8A 09 30 20 D2 FF C9 30 D0 F9 60

Online demo
This is position independent code, you can enter it at any position in RAM and call it, so it doesn't need a load address. Assuming you put it at C000 (that's the case in the online demo), call it like sys49152,0 or sys49152,1 -- any other input is undefined.
Explanation:
20 FD AE    JSR $AEFD    ; consume comma
20 9E B7    JSR $B79E    ; evaluate number, result in X
8A          TXA          ; transfer X to A
09 30       ORA #$30     ; convert to numeric character
20 D2 FF    JSR $FFD2    ; output character
C9 30       CMP #$30     ; compare with '0' character
D0 F9       BNE *-5      ; not equal? Then jump back to output (-7)
60          RTS          ; return

JavaScript, 26 bytes - Variation of Solomon Ucko's answer
I find it weird how I can't comment, but I can edit his answer...
for(;alert(i=prompt())|i;)

><>, 6 Bytes
::n?!;

Input is assumed to be on the stack. It's duplicated twice, printed, and checked if it's non-zero. If it's non-zero, skip the end program command and loop around.
Note that this does not print any spacing between the 1s.

Acc!!, 39 37 bytes
N
Count i while _%2-i%2+1 {
Write _
}

Try it online!
This takes input through N, then prints the input _ until the equation _%2-i%2+1 is 0. This looks like:
48
  48%2-0%2+1 => 1
  48%2-1%2+1 => 0
  48%2-2%2+1 => 1
  48%2-3%2+1 => 0
49
  49%2-0%2+1 => 2
  49%2-1%2+1 => 1
  49%2-2%2+1 => 2
  49%2-3%2+1 => 1

This is shorter than the easy approach (39 bytes):
N
Write _
Count i while _%2 {
Write _
}

Try it online!

AWK, 20 bytes
{do{print}while($0)}

This is the first thing I came up with. I tried to come up with something clever more clever but they were all longer.
Try it online!

Forked, 22 21 bytes
-1 thanks to BMO
v >%&
$ |
>-:
  |
 %<

The IP path looks like this if the inputted integer is truthy:
v
|
>-v
  |
 %<

Upon hitting % (print as integer), it goes off the edge of the playing field and wraps around, running >% infinitely.
It takes this path if the inputted integer is falsy:
v >%&
| |
>-^

It prints % 0 and then exits &.

ORK, 395 bytes
There is such a thing as a m.
A m can p a word.

When a m is to p a word:
I have a scribe called W.
W is to write the word.
I have a linguist called C.
C's first operand is the word.
C's second operand is "1".
C is to compare.
If C says it's equal then I am to loop.

When this program starts:
I have a inputter called R.
I have a word called N.
R is to read N.
I have a m called M.
M is to p N.

Try it online!

Here's the ungolfed version, which is not a whole lot different:
There is such a thing as a truth machine.
A truth machine can process a word.

When a truth machine is to process a word:
There is a scribe called Keymaker.
Keymaker is to write the word.
There is a linguist called Chomsky.
Chomsky's first operand is the word.
Chomsky's second operand is "1".
Chomsky is to compare.
If Chomsky says it's equal then I am to loop.

When this program starts:
I have an inputter called Dave.
I have a word called Input.
Dave is to read Input.
I have a truth machine called Hal.
Hal is to process Input.

The first paragraph defines a truth machine class with one member function, process, which takes a string (i.e. word).
The second paragraph defines process: write the string out, and then compare it against "1". If it's equal, loop.
The third paragraph defines our main function: read a string in, instantiate a truth machine, and have the machine process the string.
Simple, really.

Stax, 5 4 3 bytes
Crossed out 4 is still 4 ;(
wQc

Try it at staxlang.xyz!
 w      Until popping results in a falsy value:
  Q       Peek and print with a newline.
   c      Copy the value atop the stack.

I'm loving this new language.
Thanks to @Weijun Zhou for reminding me of implicit input.

I am glad to find another user of Stax writing impressive answers. Maybe you should check out the chat as well although there are not much to see at the moment.

You don't need the comma at the beginning. There is implicit input.

Also I suggest you use this link: https://staxlang.xyz/#c=wQc&i=0%0A1&a=1&m=2. It automatically runs your program.

@WeijunZhou Whoops, thanks!

generator version(5 bytes)

Reflections, 26 bytes
  _:#_: _<
/#_v     /
\: /

Test it!
Explanation:
The _ at position (2|0) reads a line from input, : doubles the first character. Then, # redefines zero and _ at (1|0) prints that character.
: doubles the first character again, _ at (4|0) converts a digit to a number. < tests this number, if it's 0, the IP is directed upwards (out of the program). Else it's directed downwards, then left by the /, and down again by the v, left by the /. The : doubles the character again. Then, the \ reflects the IP upwards and the / right again, where # redefines zero and the _ at (1|0) prints the character. The v then directs it down into the loop again.

Ruby + -np, 16 12 bytes
p 1while~/1/

Try it online!
~/1/ matches the last line of input to the regular expression /1/
Edit: replaced ;p 0 with the -p flag making the answer -np complete, thanks to @ValueInk

you don't have to count flags any longer; just note in the body which one you've used (as you already have done)

@Giuseppe thanks, is this the consensus opinion now?

Yeah, see here.

@Giuseppe so should I call it Ruby + -n?

Use the -p flag instead to implicit print the zero ;p

Python 2, 59 51 49 33 bytes
i=input()
while i:print 1
print 0

Explanation:
input()             # take input from STDIN
while i:print 1     # print 1 if the argument is anything other than 0... input() evaluates the string and returns a value
print 0             # print 0 and exit if input() returns 0

EDIT: Saved 8 bytes thanks to @EsolangingFruit
EDIT 2: Coupla more bytes thanks to @HyperNeutrino
EDIT 3: Saved 16 bytes thanks to @HyperNeurtrino

You don't need to have str(1), you can just do print"1", etc.

remove the space between print and ' (this is Esolanging Fruit's suggestion but you added an extra space so credit them instead for 8 bytes)

also, don't take arguments, use input. k=input()>"0" and then while k:print 1 and then print 0 (note that you don't even need to do print"1", just do print 1

@HyperNeutrino Thanks. Fixed the first thing... still looking at input() it's not doing what I expect it to.

@HyperNeutrino This is Python 2, so input() returns an evaluated value instead of a string. This means that input() already returns the number.

@EsolangingFruit Right. Ok so then you can just do k=input() and then while k:print 1 and then print 0

Rust, 90 bytes
use std::io::*;fn main(){let
b=&mut[0];stdin().read(b);while{stdout().write(b);b==b"1"}{}}

Try it online!

Pepe, 15 bytes
REeErEErReEEree

Try it online!
Explanation:
REeErEErReEEree  # Full program
REeE             # Take input as number
    rEE          # Create label 0
       rReEE     # Output number -r (preserve)
            ree  # Goto label 0 if [input] != 0

Flobnar, 10 bytes
<1._
|@&
0

Try it online!

VSL, 36 32 bytes
fn main(){do{print(i)}while i>0}

This is probably familiar to anyone who knows any C-esque language but this takes input using a global variable i.
Try it online!

Clam, 11 8 bytes
p=QrwQpQ

Try it online!
-3 bytes thanks to the Q global variable
Storing variables is a tad verbose in Clam...
Explanation
p=QrwQpQ
p            Print..
 =             Assignment..
  Q              Global variable Q
   r             Read next line of STDIN (automatically parsed to int if possible)
    w        While..
     Q         Q is truthy
      pQ         Print Q

Resulting JS code:
console.log(Q = arguments[0]);
while(Q) {
    console.log(Q);
}

AlgiX with -x, 3 bytes
[.]

Explanation
AlgiX takes each character of input (converts it to charcode if it's not a digit) and runs the entire code for each value, initializing the accumulator to that value each run.
In this case, there's only 1 input, a 1 or a 0, so the code runs once.
[.] - Implicit a = input
[   - If a == 0, skip to ]
 .  - Print value of a
  ] - If a != 0, jump back to [
    - Implicit output value of a

Normally, the implicit output after each run would output a as a character, however the -x flag overrides that and outputs its value instead.

NuStack, 82 bytes
putchar(c:char):int;f(i:int):int{if(i>0)putchar('1');else while(1>0)putchar('0');}

Been working on this compiler for a month and a half. Still very much a WIP, but finally at a point where I can do some PPCG with it :D
Unlike all of my other languages, this isn't some toy, esoteric, interpreted language.
It's a serious language that compiles directly to assembly (nasm syntax).
I'll probably opt to get NuStack on TIO once it's notably more feature-complete than it currently is.
Explanation:
Ungolfed version:
putchar(c: char): int;

f(i: int): int {
    if(i > 0)
        putchar('1');
    else
        while(1 > 0)
            putchar('0');
}

The first line is a function prototype that allows you to call a function defined elsewhere (think C header files)
putchar in particular is currently the only function in libns, the language's standard library. It takes a single char, and outputs it to stdout. libns is currently available for 64bit linux, so it just makes a syscall using sys_write(), and 32bit "raw", ie not running on a kernel or operating system, where putchar will use the int 0x10 interrupt to print the character in TTY mode
NuStack uses post-fix types, similar to TypeScript, and there is no type inference, so types must always be explicitly declared.
NuStack also doesn't have type casts yet, or do..while loops, so this is, as far as I know, the golfiest way to do it.

Verbosity v2, 290 bytes
IncludeTypePackage<OutputSystem>
IncludeTypePackage<InputSystem>
IncludeStructurePackage<Loops>
input=InputSystem:NewInput<DEFAULT>
outpu=OutputSystem:NewOutput<DEFAULT>
condi=InputSystem:ReadEvaluatedLineOfInput<input>
Loops:ConstructLoop<Do;condi>[OutputSystem:DisplayAsText<outpu;condi>]

Try it online!
First non-trivial Verbosity v2 answer! Although how it works is very trivial, as you can see from the ungolfed version:
IncludeTypePackage<OutputSystem>
IncludeTypePackage<InputSystem>
IncludeStructurePackage<Loops>

input  = InputSystem:NewInput<DEFAULT>
output = OutputSystem:NewOutput<DEFAULT>

condition = InputSystem:ReadEvaluatedLineOfInput<input>

Loops:ConstructLoop<Do; condition> [
	OutputSystem:DisplayAsText<output; condition>
]

Try it online!
Simply enter a do...while loop, which prints the input at least once, then terminates if it's falsey (i.e. 0).

MathGolf, 5  4  3 2 bytes
-1 for dropping block marker
q▲

Explanation
Implicit input
Starts a block
q  Output TOS without a newline.
 ▲ Execute the code block while the TOS is true. Executes at least once.
Implicit output

Try it online!

I think you can drop the Ä since there's nothing before it now.

tq, 3 bytes
?(?

Explanation
?,   # Take an input
  (? # Extend the array while
     # the input is not false

AWK, 17 bytes
{while($0)print}1

Try it online!

Same effect, with 17 bytes, using a for statement instead of a while: {for(;$0;)print}1, or even $0{for(;;)print}1

MAWP v1.1, 18 14 bytes
@A{1A:.}1M[!:]

-4 bytes with integer input.
Try it!

Nice answer! You should specify it is MAWP 0.1 (0.0 is not allowed, by the way, because it is not a programming langauge at all).

OH, sorry about that, I just used the answer generator here: https://8dion8.github.io/

dotcomma, 8 bytes
[,].[.,]

Try it online!
Dotcomma is a language I recently invented, designed to do things in an interesting way with as few instructions as possible. In order to accomplish this, there are two operators (predictably . and ,) which can do entirely different things depending on context. This answer's explanation will be very introductory. To see some more complicated code, check out the examples in the page linked in the title.
This program is actually a pretty neat showcase of some of the more interesting features of dotcomma. You'll notice it's divides into two main parts, [,] and [.,], separated by a .. These are called blocks. Every block and operator has a return value.
The way dotcomma manages to do so many different things with each operator is by changing what they do based on what precedes and follows them. Take the , in the first block. Because it is at the start of a block, its return value will be a value taken from input. Because it is at the end of a block, it will also output this value and use it as the block's return value. Surprisingly compact for a language with four valid characters!
As for the first ., because it is preceded by a block, it will take the block's return value and use it as its own. It is followed by another block, so it will do one two things: if its return value is 0, the block will be skipped. Thus, only 0 will be outputted and the program will terminate.
However, if its return value is 1, the block will be looped. Within the block are two operators: .,. The . will have a return value of 1, as it follows the beginning of a block. The , will behave similarly to the first one, but instead of taking the number to be outputted from input, it will take it from the . (which will always be 1). The loop will run forever because the , will always set the looped block's return value to 1.
Hopefully this explanation isn't too confusing!

Why didn't I upvote this until now????? Every single Dotcomma answer needs an upvote.

NDBall, 57 chars, 8 cells in 2 dimentions
(0)>0
(1)%
(2)Y[1,>0,>1]
(3)P
(4)E
(2,1)>1
(2,2)P
(2,3)<1

Visual representation of code (hand made by me)

Checked in NDBallSim V1.0.1

05AB1E, 3 bytes
i[?

Try it online!
i[?  # full program
i    # if...
     # implicit input...
i    # is 1...
  ?  # output...
     # implicit output...
  ?  # without trailing newline...
 [   # forever
     # implicit end loop
     # implicit end if
     # implicit output

Python 3, 35 bytes
n=input()
while 1:print(n);0/int(n)

Welcome to the site! Nice first answer.

Also, golfing with suggested edits is usually not recommended, I'll leave a comment on xnor's answer for you.

@RedwolfPrograms Thanks for the tip  I'll pay more attention next time

No problem, it happens a lot. Hopefully you'll get to 50 rep soon!

convey, 10 bytes
{,!"}
 >"^

Try it online!
There's a few ten-byters i've found, but I can't see any way to get lower. I was thinking of this. but unfortunately that doesn't parse.

v³, 6 bytes
;@=.$#

Unwrapped:
  ;
@ = . $
  #

The IP starts at the top cell. ; takes the input as a numeric value. The IP then falls to =, printing the value. It hits ground (#) and starts moving to the right. . is a no-op. $ ignores the next command if the value is not zero. The IP wraps around to @, which terminates the program. The program repeats from = if it hasn't terminated.

Built-out, 5 bytes
truth

Yay, built-ins! ...just kidding.
Before running: push input to stack 2

truth

t      - not last 't': swap stacks 1 and 2
 r     - convert character (1-9) at top of stack 1 to integer
  u    - toggle EOF loop if top item of stack 1 is falsy (0)
    h  - duplicate top of stack 1
       - implicit: pop item of stack 1 if not empty, then go to previous 't' if stack 1 is still not empty AND 'u' did not toggle it off, terminate otherwise
   t   - last 't': return here if stack 1 is not empty

Try it online! (fork the project)

Grok, 10 bytes
:}1j
z}zhq

Explanation:
:}      # If input is 0, goes down and to the left, outputs 0,
z}  q     wraps to the right, and terminates.

:}1j    # If input is non-zero, goes to the right, pushes 1,
 }zh      prints 1, and loops indefinitely.

Stax, 4 bytes
Wq|c

Run and debug it
W    - loop over rest of program forever
 q   - print without popping, with no newline
  |c - exit if value at the top of stack is truthy without popping

Welcome to the site, and nice first answer!

2D Deadfish, 7 bytes
(o^)>o<

It is a new 2D esolang based on Deadfish~ I made recently. Read more on it in the link in header.
Explanation
IP starts at the beginning with direction right. Statements inside parentheses is only executed if accumulator is 0. And input is set to the accumulator, or else 0.
So if you give input 0,

Parentheses block will start
o will output accumulator (which is 0)
^ will change direction to up
It will eventually hit EOF token
And terminate soon!

And for input 1,

Skip the parentheses and jump to >
> changes direction to right (It keeps moving right)
o outputs accumulator (which is 1)
< changes direction to left (back)
o outputs 1 again
> changes direction to right
IP dances and repeats outputting 1

How to run it?
No online interpreter for now. but coming soon.
Until then clone the repo, and run interpreter.py. It will prompt you for the program first. When done typing program, hit CTRL+D (linux) or CTRL+Z (windows). And provide your input (if you don't want to give keep it blank) and hit enter. The program will start to run.

Piet, 12 codels
Codel size 16:

Instructions:
INN
DUP (start)
DUP
OUTN
PTR (back to start if 1; continue if 0)
POP

It has the following behavior for other values:

if n % 4 == 1, print n forever
else, print n once and terminate

if n % 4 == 2, there will be a stack underflow error, as the code path is as follows:
INN
DUP
DUP
OUTN
PTR
SWITCH (empties the stack)
PTR (error)
POP (error)

AHHH, 24 bytes
AHHHHhHHhhHHHHHHhhHHhhhh

AHHH is a somewhat more capable BF derivative in which every program consists of screaming.
Try it online!
Explanation
AHHH  Begin program
HhHH  Read int into current cell
hhHH  Write current cell's value as int
HHHH  Loop while current cell is not zero
hhHH    Write current cell's value as int
hhhh  End loop

Desmos, 33 bytes
n->ni+1,o->[1...n]0+i
i=0
o=0
n=0

The top line goes in a ticker, while the other lines are regular equations.
The input goes in variable i, while the output is shown in variable o.
Press the ticker (metronome icon) to start running the code.
Try It On Desmos!
Explanation
n->ni+1: If i=0, it becomes n->1, so n will always stay at 1. If i=1, it becomes n->n+1, so n will infinitely increment by 1.
o->[1...n]0+i: [1...n]0 creates a list of zeroes with length n. As shown with n->ni+1, if i=0, the length will always stay at 1; otherwise, it will keep increasing. +i simply converts the list of zeroes to a list of i's. So in summary, if i=0, then the list stays at length 1 and is populated with 0's. If i=1, then the list length is always increasing and is populated with 1's.
The rest of the code: It is simply to define the variables used in the actions above.

tinylisp, 31 bytes
(d A(q((N)(i N(A(c 1(disp 1)))0

Defines a function A that takes the required input, as tinylisp has no concept of program input.
Try it online!

You could if you so wanted replace all of the digits with N ;-)

PostScript, 36 bytes
.runstdin 0 eq{0 =}{{1 =}loop}ifelse

Probably needs to be run through ghostscript to get the .runstdin operator.

Shell (posix), 26 bytes (code) + 1 (input) = 27 bytes
run:
$ ./<name> <1 or 0>

code:
[ $1 = 1 ]&&yes 1||echo 0

Explained:
[ $1 = 1 ] is a hacky way of evaluating if argv[1] is equal to 1
in bash && executes if the previous command finishes with exit code 0
yes 1 yes is a command that takes in a string and prints continually to stdout
in bash || executes if the previous command finishes with a non-zero exit code
echo 0 self explainatory.
Old versions
[ $1 -eq 1 ]&&yes 1||echo 0

[ $1 == 1 ]&&yes 1||echo 0

Welcome to Code Golf, and nice answer!

Leaf-Lang, 43 Bytes
Note: Link to interpreter is liked above.
code:
input toNumber 1=while 1 print stop 0 print

hyperscript, 39 bytes
init log prompt()repeat while it log it

Full program
hyperscript, 44 bytes
def f(n)repeat while n>0 log n end log n end

Function

n: <input type="number"style="font-size:1.5rem;width:4.5ch"_="on change call f(my value)" />

(Note: it will crash if you give it 1)
AFAIK hyperscript can't take input from STDIN, so I'm using a function instead.
Ungolfed:
def f(n)
  repeat while n > 0
    log n
  end
  log n
end

39 byte “full program”: init log prompt()repeat while it log it

shell, 28 bytes
[ 0 -eq $1 ]&&echo 0||yes 1

Ruby, 32 30 bytes
p gets.to_i<1?0:loop{p 1};exit

BotEngine, 24 3x7=21
v 0
>IS0>CP
  >eP

The digit 0 is a no-op, allowing me to do stuff like this.

Loader, 30 bytes
run from m.ldr (or replace the m in the last line with the name of the file)
~B:set B =@IN
print B
B:load m

Theoretically infinite, in practice will result in Error: Stack Overflow in the reference implementation.
With comments:
~B:set B =@IN !!If B is zero (the default for uninitialized variables), set B to a number from the input
print B !!Exactly what it says on the tin
B:load m !!If B is nonzero, load a separate instance of this module on a copy of the current memory space

Math++, 11 bytes
?>a
a
2*a>$

Explanation:
1:Set a to a number from the input
2:Print a (the designator ">out" is implied if none is specified)
3:If a is 1, go to 2; if a is 0, exit

Could you add an explanation?

@VoteToClose Done

APL, 9 bytes
{⎕←⍵:∇⍵}⎕

Explanation:
          ⎕  ⍝ read a number from the keyboard
{⎕←⍵:   }    ⍝ output it, and if it is true:
      ∇⍵     ⍝ call the function again with that input

HSPAL, 60 bytes
110000
000000
420000
400000
420000
400000
120000
030000
040000
010000

Stack, 67 bytes
{ '1' print a call } `a set '' input num 1 = a { '0' print } ifelse

Run by placing the stack folder into your python lib folder, and running py -3 -m stack.cli truth.stack

3var, 6 bytes
">|[w]

Each 0 or 1 is followed by a newline. I've never actually used 3var's loop features before, so this is a first for me.
Explanation
"         Read input into R
 >        Copy R into A
  |[ ]    Do while A > B...
    w     Output R

Browser LiveScript, 54 bytes
switch prompt!
|'0'=>alert 0
|'1'=>while true
 alert 1

I believe I can use prompt and alert instead of STDIN and STDOUT with browser languages, is that correct?

Yes, you are correct.

pb, 21 bytes
^t[B]v<w[B!48]{>b[T]}

There is currently only one pb interpreter. It's called pbi and it's hot garbage. I wrote it, and I have 0 other experience writing that kind of program. The pb variables are global variables in pbi's source code, loops are implemented recursively (the tokenizer turns the entire code of the loop into a single token, then when it's reached that token is sent back into the tokenizer and is executed until the condition becomes false), the function to evaluate an expression is def expression(e): return eval(e, globals())... overall it manages to do basically nothing right and I'm probably going to rewrite it.
I bring this up because pbi in its current state only outputs anything when the program terminates, so a 1 input makes it look like it does nothing forever. Here are the reasons why I believe this answer is valid anyway:

The canvas is being written to, which is how output works in pb. If the loop were to eventually terminate somehow, a lot of 1s would be outputted at once.
There is a way to watch program execution in pbi. It's intended for debugging and it's about as horrible as the rest of the interpreter, but the flag -d= followed by a number will print the canvas and pause execution for that many milliseconds after each tick.

How it works
^        # Move the brush to Y=-1, where input lives
t[B]     # Save the value at (0, -1) to T
v<       # Go to (-1, 0)
w[B!48]{ # While the space under the brush doesn't have the value 48 ('0'):
           # (this loop is guaranteed to be entered at least once)
  >        # Increase the brush's X coordinate by 1
  b[T]     # Save the value in T to the brush's current coordinates
}        # If the input was '0', the space under the brush has the value 48 and the loop is
         # terminated. Otherwise, it repeats indefinitely.

C++, 83 77 76 bytes
#include<iostream>int main(){int n;std::cin>>n;do{std::cout<<n;}while(n);}

Ungolfed:
#include <iostream>     // Needed for IO
int main()              // Necessary for any C++ program
{
    int n;              // Declare integer variable
    std::cin >> n;      // Retrieve input from STDIN
    do                  // Perform the following at least once
    {
        std::cout << n; // Output number, either 0 or 1
    } while(n);         // Continue doing so if number wasn't 0
}

Thanks to @feersum for letting me know that input can only be 0 or 1 I saved 6 bytes.
Thanks to @Alex A for saving another byte by removing a space

n is already 0 or 1 after you read it. n=!!n does nothing at all!

Oh so I needn't account for situations where STDIN contains numbers that aren't 0 or 1?

0 and 1 are the only possible inputs.

Sweet! Thanks for letting me know! I will update my answer.

You can remove the space before <iostream>, saving 1 byte.

With certain compilers (e.g. gcc-5.1) you can omit the return type of main which would save you four bytes.

You can save a byte because you don't need to wrap the std::cout<<n statement into a block, do std::cout<<n;while(n); suffices.

???, 37 bytes
?!";.;.--,'",'";,-,,,,,'";...'";!-'"

This is a simple translation of mbomb's Brainfuck solution.

SWI-Prolog, 45 bytes
m(X):-put(X),(X=48,halt;m(X)).
:-get(X),m(X).

The put and get predicates work with character codes, so we need to test against 48 for the 0 case. If that succeeds, halt; if it fails, try m(X) recursively instead.
To run from Linux command-line, put the code in a file and execute swipl -qs truth.pro. (The q is optional; it suppresses extra output from the interpreter.) Or, try it here.

I guess you can remove the halt, since directives are only executed once (next() and close()). But the link somehow doesn't work, it gives an error.

On the other hand to be ISO Prolog compliant, you would need initialization/1 http://www.swi-prolog.org/pldoc/man?predicate=initialization/1, since arbitrary directives are not allowed. The above would run in GNU Prolog.

@j4nbur53 The reason why I included halt is that with swipl on Ubuntu, not including it drops to a user prompt after the above code executes. I don't know what the exact policy on that is, but it seems like extraneous output that can be avoided, so I figured I'd better avoid it.

Batch, 31 bytes
@IF 0%1==01 echo 1&%0 1
@echo 0

On my machine, running

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes