Fixed Repeating Output

From Esolang
Jump to navigation Jump to search

Code that repeats a fixed amount of times given from input, while repeating, output 1, then output 0 after the loop is done.

This shows that the esolang can support fixed loops, and I/O.

For example, if you input 5, then it'll output this.

1
1
1
1
1
0

or, depending on the esolang, it'll probably output this instead.

111110

Implementations

:]

:) :|
:]] :)
  :0 1
:[[
:0 0

brainfuck

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

Source code, in BFFuck:

x=in
while(x)
outc(49)
outc(10)
sub(x,1)
endwhile
outc(48)

Another one which support bignums:

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

there is a counter stored as unary on the tape, every time a digit is entered counter *=10, and each unary digit is added by 48 to produce the output.

Brainfuck+2

';[>+:-<-]>:

How dare you fuck the brain

IIIII # Input
^Iv
D^Nv)NH

STRong

Input is in unary

pa`
:0:digit
'a'?
.loop
'{p}~;digit'<1>
'p~`'<0>
^p^loop

External Resources