# Create a Parrot Program

Given an input, output that input followed by a newline endlessly.

Input will be a string consisting only of printable ASCII characters (0x20-0x7E) and newlines (0x0A).

If input is length 0, endlessly output newlines.

This is so fewest bytes in each language wins!

• Half of yes is 91 lines long. Jun 5 '17 at 9:08
• So related it hurts. Jun 5 '17 at 13:23
• @VoteToClose I knew I've answered this before.. Jun 6 '17 at 9:49
• Microsoft, 1 Steve Ballmerdevelopers, developers, developers, developers, ... Jun 8 '17 at 0:43

## SAS, 32 bytes

%macro t(s);%put&s;%t(&s);%mend;


## PowerShell, 17 bytes

This one taking a reasonable position towards the shorter end of the non-golf-langs:

$f={for(){$args}}


The infinite recursion approach works, at least for a while, but isn't as terse:

$f={($s="$args");&$f $s}  # Husk, 1 byte ∞  Try it online! In Husk, ∞ builds an infinite list repeating its argument forever. If a full program produces a list of strings as result, they get printed by joining them with newlines. The wonderful thing about Husk's laziness is that computations involving infinite lists can be managed and used to produce useful output, like in this case :) # T-SQL, 45 bytes CREATE PROC r @ TEXT=NULL AS G:PRINT @ GOTO G  Usage EXECUTE r 'Hello word!'  # Keg, -pn, 2 bytes {⑩  Try it online! Forever, print the top of the stack with a newline without popping it. # Actually, 6 bytes 1W@;.@  Try it online! Explanation: 1W@;.@ (implicit input) 1 push 1 W loop while top of stack is truthy: @ move input to top of stack ;. duplicate and print @ move 1 to top of stack to continue loop  ## QBIC, 3 bytes {?;  Explanation { DO ? PRINT ; a string read from the cmd line DO is implicitly closed by EOF  • What on earth is QBIC in Google Drive for??? Jun 5 '17 at 18:16 • @MDXF 'cause I can't handle any other source control solution... Jun 5 '17 at 19:55 # Go, 46 bytes import."fmt" func f(s string){for{Println(s)}}  Try it online! ## Recursive approach, 46 bytes Surprisingly, a recursive approach led to the same byte count. import."fmt" func f(s string){Println(s);f(s)}  Try it online! • Avoid the import."fmt" by using the built-in print command: func f(s string){for{print(s+"\n")}} Jun 5 '17 at 20:10 • @chowey That prints to STDERR, not STDOUT. Jun 5 '17 at 20:11 # tcl, 20 while 1 {puts$argv}


demo — on the green area type

tclsh main.tcl string you want to repeat


where string you want to repeat is the input for program.

DO NOT USE BACKSPACE KEY ON GREEN AREA! It will make browser go back in history.

# shortC, 7 bytes

AWJ@[1]


Explanation:

A        main function
W       while loop
J      print string with newline
@[1]  first command line argument


Try it online!

# Chip, 19+3 = 22 bytes

+3 for flag -z, which adds an infinite stream of 0x00 bytes to the end of the input.

cCGgbbBAa
fF^~^dDEe


Try it online!

The behavior, in pseudocode:

out_byte := in_byte
if !(in_byte & 0x60) {
out_byte |= 0x0A
}


Basically, if both bits 0x20 and 0x40 are unset, then either we have a newline character, or we've hit the end of the input. In either case, we just output a newline character and carry on.

# Aceto, 8 bytes

>v
np
rk


Uses sticky mode to avoid having to duplicate the string.

# OIL, 12 bytes

5

4

11
6
2


Read a value into the 0th line, print the value in the 0th line, print a newline, then jump to line 2.

# Reticular, 9 bytes

i1=v
1p>


Try it online!

## Explanation:

i1=        Sets variable 1's value to a single line of input read from STDIN
v       Change direction to down
>       Change direction to right, wrap from end of line
1p        1 fetches the value of variable 1, p prints it


# Python 3, 22 bytes

while 1:print(input())


Surprised not to have seen a python 3 answer yet.

• Welcome to PPCG! This code won't work currently, as it will call input() each time, meaning it will only output the input once. I highly suggest using TIO for testing and formatting your answer, it makes life much easier Jun 6 '17 at 15:57
• I think this is as short as one can get in python3, although I'm not great at python3 golfing, I usually golf in weird esoteric languages Jun 6 '17 at 16:00
• @Mayube Ah, I misunderstood what was required. Jun 6 '17 at 16:30

## Vim, 6 bytes

Similar solution as the V answer.

Yqqp@q


# Python 3, 26 bytes

a=input()
while 1:print(a)


Try it online!

As simple as it gets.

# W, 1 byte

It's not an infinitely-repeating built-in. That will be explained in the explanation.

I


# Explanation

With implicit inputs this becomes:

aPI

I % An infinite loop with the following body:
a   % Take a single input from the arguments
P  % Implicitly print the inputted argument on every iteration
% (The above printing only occurs if the operand expression)
% hasn't been printed before
$$$$


# Hy, 34 bytes

(setv a(input))(while 1(print a))


Try it Online!