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

brainfuck

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

Source code, in BFFuck:

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

Brainfuck+2

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

:]

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

STRong

Input is in unary

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

External Resources