Fixed Repeating Output
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
;^Iv D^Nv)NH
Iterate
(*)1<
*?<
*1< @ >
>
(1*)48<
*~n< &1 >
~@
>
>
EsoBASIC
LET i INPUT i LET -= i PRINT 1 IF i GOTO 9 PRINT 0 END LET -= i GOTO 4
MoreMathRPN
inputR repeat ]0 outputS "1" next outputS "0"
STRong
Input is in unary
pa`
:0:digit
'a'?
.loop
'{p}~;digit'<1>
'p~`'<0>
^p^loop