#JAISBaL, 1515 6 bytes
or 11*
n˒q1˕-1˓e0®˗Y1˄N0
Explanation:
# \# enable verbose parsing #\
n} \#while request input #\
ifelse \# if the top value of the stack is truthy, execute the next block, otherwise, execute[0] thestart elsewhile blockloop #\
printnumln 1 \# print 1 #\
jump -1 \# jump[1] -1print instructions1 #\
else \# end the truthy section of the ifelse block #\
printnum 0 \# print 0 #\
end \#[2] end current language construct #\
Side note 1:
An alternative 10 (or 8*) byte version is:
nD˅q1˕-1
which does basically the same thing as the above, but uses the fact that JAISBaL outputs some information at the end of any program, including the remaining contents of the stack.
Explanation:
# \# enable verbose parsing #\
n} \# request input #\
duplicate \# duplicate the top value of the stack #\
ifblock printnum 0 \# if the top value of the stack is truthy, execute the next block #\
printnumln 1 \#[3] print 1 #\
jump -1 \# jump -1 instructions0 #\
*A few bytes are saved if the character encoding used is the JAISBaL Character Encoding Scheme
**Tested on command line tool / gui 0.0.4