g | x | w | all
Bytes Lang Time Link
nanRaku Perl 6 rakudo250415T213131Zxrs
nanTcl250409T204211Zsergiol
102Go230202T231501Zbigyihsu
009Trilangle f230414T132124ZBbrk24
025Python230414T122148ZThe Empt
025Python 3230413T212445ZHunaphu
nanFig230207T151102ZSeggan
nanGolfScript230207T135122Zemirps
nan230204T180024ZThe Thon
nanNim220606T145918ZQaziquza
014Zsh220605T204733ZGammaFun
014Nooklang220422T131215Zoeuf
037Javascript211116T174301Zspidunno
031JavaScript211118T152106ZCreaZyp1
022Zsh + POSIX utilities211111T223030ZGilles &
8210Vyxal211117T091802ZSjoerdPe
8680JavaScript Node.js211110T162915Zsech1p
029Zsh211111T013530Zroblogic
nanPxem210322T133257Zuser1004
nanbrainfuck210309T173759ZChristia
3710BRASCA210309T080504ZSjoerdPe
00805AB1E210308T235254ZMakonede
9101Raku raku n 910 = 1 bytes200404T030809ZSebastia
nanC gcc200404T022711ZS.S. Ann
nanKotlin200403T054619Zsnail_
1109Husk200401T100044Zuser9206
1109W s191223T115758Zuser8505
008Ahead190920T044235Zsnail_
nanMumps M191223T185550Zzmerch
nanPython 3191223T163830ZAndrew P
nanMicroscript150530T193222ZSuperJed
000Perl 5 1010 =190920T220912ZrpGYNay0
025Python 3190920T130457Zgadzooks
8102MathGolf190920T125336Zmaxb
5105><>180415T121423ZJo King
039Tcl180415T120825Zsergiol
nanChip170606T181945ZPhlarx
008TIBASIC170303T010127ZHactar
006><>170302T124638ZPidgeyUs
nanAHK170302T131441ZEngineer
023OIL170302T114126ZL3viatha
nanR170302T090035Zrturnbul
nanPython 3170302T081601Zsagiksp
051R170302T044445ZBLT
7103Jelly170302T042544Zwalpen
5105APL Dyalog APL170301T102443ZAdá
nanOhm170301T094406ZLinnea G
nanPHP170301T024848ZTitus
161CGCC170228T224458Zuser6333
nanVitsy170212T162349ZAddison
016QC 26 26 10 =170211T204250Zuser6333
nanSmileBASIC170211T194235Z12Me21
032C141218T163419Znutki
nan150804T180559ZCharlie
nan141217T164027Zcoredump
005Fission150530T230750ZMartin E
nan141224T165838Zxenia
004Pyth141218T162819Zswstephe
031Perl141221T132446Zxebtl
5363Node.js141221T051906Zchris-l
035C141221T025707ZBenjiWie
042C141220T192923Zbacchusb
038AWK141217T172931ZLeFauve
167Lazy K141220T155203Zjimmy230
013Commodore 64 Basic141217T230938ZMark
247CFML141219T211559ZMatt Gut
076C#141217T142113ZProgramF
nandc141218T151919Zuser344
012dc141219T045451ZDigital
014JAGL V1.0 20 10 = 10 With Bonus141218T054509Zglobby
nanlinux Bash141218T131754ZOlivier
040Pascal141219T133139Zmanatwor
028Fortran141219T131802Zxebtl
018Perl141217T162042Zcore1024
026Perl141217T135059ZNitz
nanRuby141217T184219Zalexande
178Java141217T235810ZYpnypn
nanLua141217T200826ZDigpoe
027Python 3141217T135702Zpgy
nanJava141218T162438ZTheNumbe
037C89141218T143934Zrubenvb
024Windows Batch141218T123641ZJean-Fra
nan141218T103508ZMatt Win
019Linux Bash141218T041918ZJohnny
nanC141218T001027ZLordAro
052Rust141218T005317ZMatt Win
029Haskell141218T001836ZTaneb
nanLinux Bash141217T172619ZOrace
nanPowerShell141217T165032ZJoey
nanCJam141217T134059ZMartin E
014Marbelous141217T153305Zoveracto
038Brainfuck141217T143518Zundergro
nanApparently this isn't totally portable. My sys.version is 2.7.9 default141217T144834Zundergro
018Ruby141217T143516ZProgramF

Raku (Perl 6) (rakudo), 18 bytes - 10 bonus = 8 pts

loop {say ~@*ARGS}

Attempt This Online!

Doesn't display properly on ATO or TIO. For one more byte it will:

say ~@*ARGS while 1

Attempt This Online!

Tcl, 30 bytes - 10 = 20 points

gets stdin r
while 1 {puts $r}

Try it online!

Go, 92 102 bytes

package main;import(."os";."fmt");func main(){s:=string('x'+1);if len(Args)>1{s=Args[1]};{Println(s)}}

Attempt This Online!

Go, 172 182 - 10 = 162 172 bytes

package main;import(."os";."fmt";"io");func main(){s:=string('x'+1);if len(Args)>1{s=Args[1]}else if f,_:=Stdin.Stat();f.Size()>0{b,_:=io.ReadAll(Stdin);s=string(b)};for{Println(s)}}

Attempt This Online!

+10 bytes for removing "y" and newlines.

Trilangle -f, 9 bytes

Doesn't contain a line feed (\n) but it does contain a form feed (\f).

"x")oo:,

Try it on the online interpreter! The -f flag has no meaning in the online version, but in the command line it means that closing stdout will terminate the program (e.g. trilangle -f yes.trg | head -n 10).

Since the form feed doesn't render, here's a hexdump (reversible with xxd -r):

00000000: 2278 2229 0c6f 6f3a 2c                   "x").oo:,

Notepad renders the form feed character as an up arrow, so I'll be using the symbol in place of the form feed for the explanation.

The code unfolds to this:

   "
  x "
 ) ↑ o
o : , .

For lack of redirections, this simply executes in order:

For lack of an explicit exit instruction, this loops forever.

Python, 25 Bytes

while 1:print(chr(~-122))

Never knew you could do bitwise operations on non-binary numbers!

Python 3, 25 bytes

while 1:print(chr(97|25))

Try it online!

Fig, \$2\log_{256}(96)\approx\$ 1.646 - 10 \$\approx\$ -8.354 bytes

(,

Try it online!

Prints the input forever. Simple.

GolfScript, 15 10-10=0 bytes

{.puts.}do

Try it online!

For some reason I thought the only way to get input from STDIN was "#{STDIN.read}, but I then realized that STDIN is already left on the stack by default.

Thunno, \$ 11 \log_{256}(96) \approx \$ 9.05 - 10 \$ \approx \$ -0.95 bytes

[z011D*C~ZK

Attempt This Online!

If calculating "11 squared" is cheating, here's one which doesn't have any numeric literals:

Thunno, \$ 12 \log_{256}(96) \approx \$ 9.88 - 10 \$ \approx \$ -0.12 bytes

[z0AzZHAK~ZK

Attempt This Online!

Explanations

[z011D*C~ZK  # Implicit input (if given)
[            # while True:
 z0          #  Push the first input if it
             #  was given, or [] if it wasn't
   11        #  Push 11
     D*      #  Square to get 121
       C     #  Get chr(121) ("y")
        ~    #  Do a logical OR, yielding the input
             #  if it was given, and "y" if it wasn't
         ZK  #  Print with a trailing newline
[z0AzZHAK~ZK  # Implicit input (if given)
[             # while True:
 z0           #  Push the first input if it
              #  was given, or [] if it wasn't
   Az         #  Push the lowercase alphabet
     ZH       #  Remove the last element, to get
              #  "abcdefghijklmnopqrstuvwxy"
       AK     #  Get the last element, i.e. "y"
         ~    #  Do a logical OR, yielding the input
              #  if it was given, and "y" if it wasn't
          ZK  #  Print with a trailing newline

Nim, 37 - 10 = 27 bytes

var x=readLine stdin;while 1>0:echo x

Attempt This Online!

Zsh, 14 bytes

x=Y;<<<$x:l;$0

Try it online!

Set x=Y, then print $x, :lowercased. $0 recurses.

Nooklang, 14 bytes

{120 1 + c p}t

Right now this isn't available on any online coding platform yet, so you will have to run the code from your computer.

Explaination:

{
  120 1 + # Returns 121 (aka ASCII value of y)
  c # Converts the value to character
  p # Prints out the character
} t # Infinite loop

Javascript, 39 37 bytes

for(;;)console.log(''+Function()[13])

Shorter alternative that only works in the browser, 36 bytes

for(n=''+crypto;;)console.log(n[10])

Alternative without console.log, only works in NodeJS, 58 57 56 bytes

for(n=''+Function()};;)process.stdout.write(n[13]+n[19])

JavaScript, 32 31 bytes

for(;;)console.log((""+1/0)[7])

Edits

Explanation

To terminate the process do Ctrl+C (SIGINT)

Zsh + POSIX utilities, 22 bytes

f()(tr 01 x-z<<<1;f);f

Thanks to pxeger for the shorter way to print y.

Try it online!

Pure zsh, 24 bytes

f()(<<<$SPROMPT[29];f);f

Try it online!

Bonus: mandatory phrase from stdin — 21 - 10 bytes

read a;f()(<<<$a;f);f

Try it online!

Vyxal, -8 bytes (2-10 bytes)

Not the most original method, but it's short.

{,

Explanation

{         - While non-zero
 ,        - Print implicit input

Try it Online!

JavaScript (Node.js), 86 80 bytes

with strict adherence to the you are not allowed to use "y" or "\n" or their ASCII values (121, 0x79, 0171, 10, 0xA or 012) rule

for(;;)console.log(eval('T\\u'+(+[])+(+[])+(38+38+3)+'peError').toString()[6+4])

Try it online!

-6 bytes thanks to me

Zsh, 29 bytes

for ((;;))<<<${(#)$((11*11))}

tio example (times out)

Not cheating like the bash answer...

Pxem, filename: 22 bytes + content: 4 bytes - bonus: 10 bytes = 16 bytes.

Try it online!

With comments

XX.z
# while size==0 || pop!=0; do
.a.wXX.z
  # push getchar; dup; push 1; push pop+pop;
  # NOTE EOF is -1
  .a.i.c\001.+XX.z
# done
.a.aXX.z
# push 11; push pop+pop;
.a\013.+XX.z
# push whatever not zero; while pop!=0; do call content; push whatever not zero; done
.al.w.el.a
XX.z
# get called, with my stack initialized to original one
# reverse; pop all to putchar for each of them
# implicitly return, pushing each content of
# my stack from bottom to pop to original one
.a.v.p

Pxem, filename: 14 bytes + content: 0 bytes = 14 bytes.

Wow, shorter than above!

Try it online!

brainfuck, 60-10=50 bytes

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

Try it online!

Explanation:

+>> add one (120 to be adden on later yeilding 'y')
,[[>,]>+<]  if there is input, read it and set a flag to skip the next loop
++++++++++>-  '\n' 
[
  <[<+<++++++++++++>>-] add 10*120 to first cell, shift \n back one cell
]
<[[<]>[.>]<] print the input or 'y\n'

BRASCA, -3 bytes (7-10)

l,[:mo]

Try it online!

Explanation

<implicit input>
l           - Push 10 (\n)
 ,          - Reverse stack
  [   ]     - While non-zero:
   :mo      - Duplicate, move the duplicate to bottom, output top of stack

05AB1E, -8 bytes

[,

Try it online!

[,  # full program
[   # forever...
 ,  # output...
    # implicit input

Raku (raku -n) 9-10 = -1 bytes

.say;redo

Idea for redo from @booshlinux (I would have done: loop{.say})

C (gcc), 30 - 10 = 20 bytes

f(a){for(gets(&a);puts(&a););}

Try it online!

Kotlin, 23 - 10 = 13 bytes

{while(1>0)println(it)}

Try it online!

Husk, 1 - 10 = -9 bytes

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 :)

Try it online!

Explanation

   Implicit argument
∞  Build an infinite list repeating forever
   Implicit join by newlines

W s, 1-10 = -9 bytes

I

Explanation

Flag: s % We have to read from STDIN :(
 P      % Newline-print
a       % the STDIN input
  I     % Forever

W, 7 bytes

i12 1CE

Explanation

i     E % Foreach from 1 to positive infinity:
         % (Implicit print a newline on each iteration)
 12 1    % Space does nothing. Basically just pushes 121.
     C  % Convert to a character, rendering 'y'

Ahead, 8 bytes

~W-1z'N~

Try it online!

Mumps (M), 12 bytes - 10 = 2 bytes

Quite simple in Mumps (M), as the language allows single character commands and a newline is denoted by '!'...

R I F  W I,!

Breakdown:

Read STDIN into I, For (with two spaces) = infinite loop, Write contents of I, then newline (!)

Works on both InterSystems & YottaDB (GT.M).

Python 3, 26-10=16 bytes

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

Seems too easy. Never posted here before so probably done something dumb. What did I miss?

UPDATE I don't think this is cheating (35-10=25):

exec("x=input()\nwhile 1:print(x)")

Microscript, 19-10=9

If['w2s]1{CaI#!Zx}h

Besides the initial input, takes an extra input after each iteration and halts when and if any of the additional inputs is non-empty (the specs for the question said to provide a way to make it halt).

Perl 5 - (10-10) = 0 bytes

print;redo

Requires the -ne flags. Takes in a character(s) from STDIN, repeats the character(s) infinitely.

Example execution

perl -ne 'print;redo'

Explanation

This takes advantage of the -n flag in Perl, where it explicitly wraps while (<>) { ... } around the source code. The use of redo without an explicit label is also used. According to the documentation: If the LABEL is omitted, the command refers to the innermost enclosing loop.

Python 3, 25 bytes

while 1:print(chr(11*11))

Try it online!

MathGolf, 8 bytes -10 = -2

╜É'x)Äo∟

Try it online!

Explanation

╜É         else without if (executes block of 3 chars if input is empty)
  'x)      increment "x" to get "y"
     Ä     start block of length 1
      o    print TOS without popping
       ∟   do while true without popping

Quite straightforward, but gets the job done.

><>, 5 bytes - 10 = -5

a{:o!

Try it online!

Takes input via the -s flag and repeats it forever until the program is interrupted.

Tcl, 39 bytes

while 1 {puts [format %c [expr 11*11]]}

Try it online!

Chip, 15+3 = 18 bytes

+3 for flag -w, which ignores stdin and generates an endless stream of null bytes for input instead.

dbae
*}++g
 `zf

Try it online!
Note about the TIO: instead of using the -w flag, it uses input. The behavior is the same, except that input is finite. One byte of output per byte of input.

Explanation

*}+
 `z

This is a 1-clock. On the first byte, the + is active, and on the second byte, the other three elements are active. The two states alternate endlessly.

d ae
* ++g
   f

This produces the output corresponding to 'y'. These letters each map to a bit: _gfed__a -> 0b01111001 -> 0x79 -> 'y'.

db
*}
 `z

This produces the output corresponding to '\n'. Similar to above, but we have these bits: ____d_b_ -> 0b00001010 -> 0x0a -> '\n'.

TI-BASIC, 8 bytes

While not(getKey:Disp Str0:End

><>, 6 bytes

b:*oao

By not including a ; at the end, the ><> will keep on swimming until he's released by a SIGINT.

Explanation

b:*oao
b         Push 11
 :        Duplicate
  *       Multiply top elements to get 121
   o      Print as character
    a     Push 10
     o    Print as character (yielding '\n')
          No program terminator, so our ><> will 
          keep on swimming this path forever.
^----' 


><>, 17 - 10 = 7 bytes

The previous is quite a boring solution, so here's one that takes input from stdin. This abuses the fact that the default way of supplying input to a ><> program is echo 'input' | fish.py yes.fish, where echo provides the \n character.

 i:0)?!v
0r}o:r~<

Explanation

 i:0)?!v     Load STDIN into the stack (reversed)

             NOP           <----------,
 i           Push a byte from STDIN   |
  :          Duplicate top element    |
   0         Push 0                   |
    )?       If (i > 0):              |
      !        Wrap around  ----------'
             Else:
       v       Move to the second part

0r}o:r~<     Print STDIN until halted

       <     Go right         <---------------,
      ~      Remove top element (duplicated   |
                -1 from EOF)                  |
     r       Reverse stack                    |
    :        Duplicate top element            |
   o         Output as character              |
  }          Rotate stack to right (go to     |
                next character)               |
 r           Reverse the stack                |
0            Push 0                           |
             Wrap around       ---------------'

The 0r at the end allow sfor the loop to happen by wrapping around, where we still assume the stack to be reversed with a -1 on top.

AHK, 38 bytes - 10 = 28

c=%1%
Loop,3
FileAppend,% c Chr(9+1),*

OIL, 23 bytes noncompeting

120
8

17

1

4

11
6
6

Increments 120, transforms it to a "y", and repeatedly print it and a newline.

Can be stopped with SIGINT / Ctrl+C.

Variant that receives something from stdin instead:

OIL, 13-10 = 3 bytes

5

4

11
6
2

R, 27-10 = 17 bytes

x=scan(,'');repeat print(x)

Repeats stdin over and over and over. No y or \n in the code.

Python 3, 40 bytes - 10 = 30

i=input()
while 1:print(i or chr(11**2))

Stops with SIGINT (Ctrl+C)

R, 51 bytes

while(T){cat(paste0(letters[25],'\\',letters[14]))}

Literally outputs "an infinite stream of "y\n"'s", rather than "y[newline]".

In RStudio the output is truncated but it is otherwise infinite.

Jelly, 7 - 10 = -3 bytes

ØyṪ³ȯṄß

Try it online!

Explanation

Øy             # The string "AEIOUYaeiouy"
  Ṫ            # Take the last element, namely "y"
    ³          # The cmdline argument (empty list if none supplied)
     ȯ         # Either the cmdline if supplied or "y"
      Ṅ        # Print with a newline
       ß       # Recurse

Thankfully Jelly programs can always be C-c-ed.

Alternative Sans Y; 10 - 10 = 0 bytes

“¢³ƒ»Ṫ³ȯṄß

If the 'y' in the original answer is unacceptable, here's one without. This works on the same principle, the string “¢³ƒ» is the compressed version of "Jelly"

APL (Dyalog APL), 5 - 10 = -5 bytes

Warning: relies on an undocumented and unsupported feature/bug.

⎕←⍣≢⍞

Empty STDIN prints empty lines (not "y"), which is allowed and has been suggested.

Try it online!

 STDOUT with trailing newlines,

 gets

 repeatedly until

 it differs from

 STDIN

i.e. never, but uninterruptible by pausing the thread.

Ohm, 17 - 10 = 7 bytes

IDö?.x1+;Ω
D,∞

Explanation:

IDö?.x1+;Ω  ■Main link
I           ■Input
 Dö?    ;   ■If(!input){
    .x1+    ■  Push 'x' and increment
            ■}
         Ω  ■Call link below

D,∞         ■Helper link
  ∞         ■while (true){
D,          ■  duplicate and print
            ■}

PHP, 34 bytes - 10 = 24

for(;;)echo$argc>1?$argv[1]:y,"
";

Run with php -nr '<code>' or php -nr '<code>' '<string>'.

Or 56 bytes for an exact port:

for(;;)echo$argc>1?join(" ",array_slice($argv,1)):y,"
";

(-2 bytes with extended ASCII; -1 for the not-so-complete version)

C(GCC) - 161 bytes

main(int argc,char**argv){if(argc>1){while(1){for(int i=0;i<argc-1;i++){printf("%s ",argv[i+1]);}puts("");}}else{char*c=malloc(1);c[0]='x'+1;while(1){puts(c);}}}

Uses malloc to allocate 1 byte and set its value 'x' + 1 If any input is provided as an argument(mulitple words work too) it will print it instead of y.

Ungolfed version:

main (int argc, char**argv) {
    if (argc > 1) {
        while (1) {
            for (int i=0; i < argc - 1; i++) {
                printf("%s ",argv[i+1]);
            }
            puts("");
        }
    } else {
        char* c = malloc(1);
        c[0] = 'x' + 1;
        while(1) {
            puts(c);
        }
    }
}

Vitsy, 15 - 10 = 5 bytes

Because Vitsy waits for STDIN to be entered, I have made the bonus input come in as command line arguments.

zl)[bD*][:ZaOu]

Explanation:

z               Grab the entirety of the input stack and patch it on the current.
 l)[   ]        If the stack has no members...
    bD*         Push 11^2 to the stack (this is the ASCII value for 'y').
        [     ] Loop infinitely.
         :      Duplicate the current stack.
          Z     Push the entire contents of the stack to output, top first.
           aO   Push out a newline to the out.
             u  Flatten the top two stacks.

QC 26 (26 - 10 = 16) bytes

(00600F014"0178)0101A01$14

The program requires an input on stdin because QC doesn't have a way to get arguments. Empty input just prints y.

Explanation

(00 read string into memory at address 00, address 00 is length, next bytes are the string itself
600F014 jump if values at 00 and F0, if not equal jump to address 14
"0178 Write 78(lowercase x) to address 01
)0101 increment value at address 01 by 01 which gives y
A01 print string and newline from address 01 until 00 is reached
$14 jump to address 14(print the next line)

SmileBASIC, 19 bytes - 10 = 9

INPUT C$@L?C$GOTO@L

C, 32 bytes

Requires little endian machine and compilation with -O2 (to avoid stack overflow).

a=11*11;main(){main(puts(&a));}

CAPL1.5+ ; 6 without input; 10 - 10 = 0 with input

Sidenote
I have read somewhere [link?] that custom languages aren't allowed in golfing questions, as they could make built-in functions that do exactly what the question is asking, however I made CAPL to make golfing easier in general. If you think this is not allowed here, let me know!

I got some ideas from ><> and Befunge (You can move between lines and use hexadecimal characters to push numbers), some from Ruby and some from my own to make golfing easier.
CAPL reads from left to right, and goes one line down at the end of the line. If it is as the last line, the program will quit.

As no-one knows this language yet, I'll try to explain as much as possible.

Outputting y. 6 bytes

bb*.n<

bb* b is hexadecimal for 11, so bb* is 11*11=121, which is the UTF-8 equivalent of y. This value is pushed to the stack.
. Pops the top value from the stack, and outputs as UTF-8. As 121 is on top of the stack, the index is ignored here.
n Outputs a newline
< Sends the pointer back to the beginning of the line, thus repeating that line. As we don't expect input, we can do this safely without re-asking for the input.

Outputting from input. 10 bytes, 0 after bonus

i~a&{X:.)}

i Takes input from the user, pushes as UTF-8 on the top of the stack, and pushes the length after that. I.e. [72,101,108,108,111,5]
~ Pops a number from the stack, then reverses that amount of bytes. I.e. [111,108,108,101,72]
a Hexadecimal for 10, the newline character
&{...} Makes an infinite loop. We have input, so we can't send the pointer back to the line. I could place the function on the line below, which would safe me a byte, but newlines aren't allowed in this challenge.
X Removes the top value from the stack (The index from the loop)
:. Duplicates the top value, then outputs as UTF-8
) Turns stack right. ([1,2,3,4,5] -> [5,1,2,3,4])

Howver, this means we start with a newline, then start outputting the input, then a newline, then the input, etc. If we're not allowed to start with a newline, use the following code with 12 bytes, or 2 after subtracting the bonus.

iXa#~&{X:.)}

The only new command here is #, which pushes the amount of items on the stack to the stack.
I removed the length from i, because adding 1, then swapping with the newline is longer than removing and getting the length again.

Just for fun, here is a "Hello World" program

"Hello World"#~
#?!;.<

The ?! operation is the same as ><>'s

Common Lisp : (30-10) = 20

(format t"~@{~a~%~:*~}"(read))

You can break the loop with Ctrl+C, which signals an error with restart options (continue/abort).

Fission, 5 bytes

Rx+!N

This is fairly competitive for Fission. :)

Control flow starts with a (1,0) right-going atom at R. x sets the mass to 120, and + increments it to give (121,0). Then ! prints the corresponding character (y) and N prints a newline. The source code wraps around at the edges, so the atom passes R again (which doesn't do anything now), x sets the mass to 120 again, + increments it and so on and so on...

This works in my Befunge interpreter:

"z"1-.25*.

10 chars. "z" means push the ascii value of the characted "z", 1 means push the number one, - means subtract, . means print the ascii value of it and * means multiply. For more info: http://en.wikipedia.org/wiki/Befunge

Pyth, 10 9 6 bytes - 10 = 0 -1 -4

#|zePG

I've been trying for ages to get one that I'm satisified with. Basically converts to:

#      = while True
(implied print)
|      = or
z      = (automatically initialized from stdin)
ePG    = second-to-last lowercase letter = 'y'

Perl, 31

Here is a Perl version that actually behaves like GNU yes, as far as I can tell:

{print "@ARGV"||chr 11**2;redo}

This works if it is okay to use perl's command line switches (-l for the newline), otherwise it would become 3 characters longer:

{print "@ARGV"||chr 11**2,$/;redo}

Node.js, 53 chars (63 if you count node -e "")

update:


The real yes does not uses stdin, but an argument, like:

yes n

Well, this answer works like that, it will print y\n over and over:

node -e "for(;;)console.log(process.argv[1]||34 .toString(36))"

And if you append an n after the line, it will print n\n instead:

node -e "for(;;)console.log(process.argv[1]||34 .toString(36))" n

No bonus, since I'm not using stdin.

C, 35 bytes

main(a,b){b='x'+1;for(;;)puts(&b);}

I don't know if this will compile correctly with all compilers on all platforms or not; if it doesn't work for you, let me know. I used several things here that I have never thought of using before. :)

C 42

main(){while(1){putchar(11*11);puts("");}}

AWK, 38 bytes

BEGIN{for(;;)printf("%c%c",60+61,5+5)}

Variant which will read the string on stdin: 14 bytes-10 = 4

{for(;;)print}

But since it cannot do both (revert to "y" if no stdin is provided), I'm not sure it counts... :o)

Both can be exited with Ctrl+C.

Lazy K, 167 bytes

`k````ssi``s`k``ss`k``siik``s`k`s``si`k```s``s`kski``s``s`ksk``s``s`ksk```s``s`kski``s``s`ksk``s``s`kski``s`kk``s`k`s``si`k``s``s`ksk```s``s`kski``s``s`ksk``s``s`kskik

It is probably too long...

```ssi``s`k``ss`k``siik                                              fixed-point combinator
``s``s`ksk```s``s`kski``s``s`ksk``s``s`kski                          \n
```s``s`kski``s``s`ksk``s``s`ksk```s``s`kski``s``s`ksk``s``s`kski    y

Commodore 64 Basic: 14 13 bytes

1?C|(11↑2):R╭

As usual, I've made substitutions for characters in PETSCII that are not present in Unicode. | is used to represent SHIFT+H, while represents SHIFT+U. Note that this outputs ASCII 'y' (byte value 121) rather than a character that the default Commodore character set displays as 'y'.

BASIC is supposedly an easy-to-learn, English-like programming language. Throw in the typing shortcuts present in many early dialects, and you get something that is shorter and less readable than Perl.

EDIT: In "shifted mode", this gets two bytes shorter, thanks to lowercase "y" being encoded at decimal value 89. Using a non-ASCII character set to get around the "not allowed to use their ASCII values" rule might be cheating, though.

1?cH(89):rU

CFML, 247 bytes

This is more a "just for the heck of it" answer, as it's obviously hideously long (CFML earns no points for terseness); and I just realized it can't actually be killed without restarting the service, although it will indeed stop printing to the browser on an ESC character.

<html><body><cfflush><cfif isDefined("URL.i")><cfscript>a=URL.i;if(a is ""){a=chr(asc("x")+1);}while(1){writeOutput("#a#<br>");getPageContext().getOut().flush();}</cfscript><cfelse><form action="a.cfm"><input name="i"/></form></cfif></body></html>

C#, 81 78 76 bytes

Cannot compete with the other languages, but here it is anyway:

class A{static void Main(){for(;;)System.Console.WriteLine((char)('x'+1));}}

Can be killed with SIGINT by pressing Ctrl+C.

No bonus, because it would take more than 10 bytes to get it.

dc, 21 bytes - 10 = 11

C1st?st[ltP[]ps0dx]dx

Note that the input needs to be wrapped in [], e.g. [no], because ? is the only way to take input, which executes it as dc code.

dc, 12

[30986Pdx]dx

Only outputs y\n. Doesn't read from stdin, so no bonus.

30986 is 0x790A (i.e. "y\n"). The P command simply converts the number to base 256, and prints the corresponding character for each base 256 digit.

JAGL V1.0 20 - 10 = 10 With Bonus, 14 Without

Tdn{78h[}Sf{p9[pDd}u

Coulda probably done better, but here is the explaination:

Td                               Get a line of text input, and duplicate on stack
  n                              Negate its truth value (for the if)
   {78h[}                        Push a block which will push the y character, if called
         Sf                      Swap top two values on stack and if no input, push y
           {p9[pDd}              Push block which prints the input (or y) and a newline
                   u             Do until loop. Output always evaluates to true

Can be killed by SIGINT

Without bonus:

'x  '{1+}/{pd}u

explaination:

'x  '                            Pushes the string '\tx'
      {1+}                       Adds 1 to each character in the string, making it 'y\n'
          {pd}u                  Infinitely prints and duplicates 

linux (Ba)sh, 13 to 26 (23 to 36 chars) (repeats 'y' or the input, like yes)

create an executable (+x) file, named as you like (ex: my_yes), containing one of those possible contents:

echo ${*:-y};exec $0 $*  #23 chars, score 13, but loses spaces, and will choke on many inputs

or

echo "${@:-y}";exec $0 "$@"  #27 chars, score 17, but will choke on some inputs

or

printf "%s\n" "${@:-y}";exec $0 "$@"  #36 chars, score 26, a tiny more robust, but "longer"

and then execute it with the arguments you want, it will repeat them ad-lib. (With no arguments, it repeats "y", as the yes command does too)

$ chmod +x my_yes
$ ./my_yes
y
y
y
[ctrl-C]

$ ./my_yes '  It looks ok!'
  It looks ok!
  It looks ok!
  It looks ok!
  It looks ok!
[ctrl-C]

Pascal: 40 characters

begin while 1=1do Writeln(Succ('x'))end.

Outputs “y”, stops on SIGINT.

Fortran, 28

do1;1 print'(A1)',11**2;end

Compile with gfortran -ffree-form.

Perl: 18 bytes - 10 = 8

The string is from STDIN.

$_=<>;{print;redo}

Perl, 26 bytes

{print chr$=*2+1,$/;redo}

Custom input from argument (like yes actually works), 22 bytes-10=12

{print @ARGV,$/;redo}

Custom input from stdin, 22 bytes-10=12

while(<>){print;redo}

Ruby, 27 bytes - 10 = 17

It's just @ProgramFOX's solution with the bonus (it took my 9 bytes to solve the bonus question).

loop{puts ARGV[0]||?x.succ}

Java, 178

class C{public static void main(String[]a)throws Exception{for(char c='x'+1;;)((java.io.PrintStream)Class.forName("java.lang.S"+c+"stem").getField("out").get(null)).println(c);}}

Printing requires System, but the y character is forbidden. Hence, I had to use reflection.

Lua, 42 bytes - 10 = 32

while 1 do print(...or('').char(90+31))end

Lua, 49 bytes - 10 = 39

y=...or(string.char(60+61))while 1 do print(y)end

Both were tested with Lua 5.1.4 and can be killed with SIGINT (Ctrl+C).

Python 3, 27 bytes

Works with at least CPython and Jython.

while 1:print(str(help)[1])

SIGINT stops it.

Java, 157 154 bytes

Despite the common misconception that you have to use System.out to print anything to the console in Java, this program outputs to the console using a FileOutputStream to the file described by FileDescriptor.out. Accoding to the specification for FileDescriptor.out, it is "A handle to the standard output stream. Usually, this file descriptor is not used directly, but rather via the output stream known as System.out".

class A{public static void main(String[]a)throws Exception{for(;;)new java.io.FileOutputStream(java.io.FileDescriptor.out).write(new byte[]{120+1,9+1});}}

C89, 31 37 chars

main(){for(;;)printf("%c\n",'z'-1);}

Built on the idea of @LordAro, without filename requirements.

Windows Batch: 24 bytes

A yes.bat file with this content will work on most Windows XP and later systems with default settings:

@echo %COMSPEC:~12,1%&%0

Else this slightly larger yes.bat file (34 bytes) will work in all cases:

@set "T=%~n0"
@echo %T:~0,1%
@%0

Can be made down to 13 bytes if the file is called y.bat instead of yes.bat, but I feel that's cheating:

@echo %~n0&%0

Plan 9 rc: 20-10=10 (but not quite there)

f=`{cat};while()echo $f

The problem with this almost-solution is that it must have something on stdin. I haven't yet been able to find a way to get it to print y if stdin isn't there.

Linux Bash - 19 bytes

This is probably cheating and subject to failure if you don't have /usr/bin/yes or have a /usr/bin/xes or /usr/bin/zes:

/usr/bin/[x-z]es $*

I think it meets the requirements, though maybe it's violating the "nothing that evaluates to y" rule. And perhaps imitating yes by actually running yes is against the rules.

This could be optimized a bit (though less likely to work) to take it down to 11 bytes:

/*/*/?es $*

I couldn't figure out how to get the 10 point bonus by reading a string from stdin without adding more than 10 bytes to the code

C, 64 55 53 45 40 - 10 = 30

main(int c,int**a){for(;;)puts(a[c>1]);}

I'm not hugely happy with this, as it requires the program to be named "y", and to be called with `y` only, so it has to be in $PATH, but hey, first codegolf :)

Alternative:

C, 30 (+ 1 filename)

main(){for(;;)puts(__FILE__);}

Using the same technique as my esteemed colleague @Matt Windsor

Rust, 52 chars

fn main(){loop{println!("{}",'Y'.to_lowercase())}}

There just isn't seemingly a nice way of computing y without being cheeky in Rust-- they've made too good a job of doing chars safely. I:

Nor is going for the code bonus worth it, because reading from stdin would require error handling =3

Much of the code reductions I could find involved doing increasingly rule-flouting things with the compiler environment:

Rust, 44 chars (+ at least 1 char for filename)

fn main(){loop{println!("{:.1}", file!())}}

Obsoleted by below. This one probably doesn't count, as the name of the source file needs to begin with y.

Edit: Rust, 36 chars (35 source, 1 filename)

fn main(){loop{println!(file!())}}

As above, but the file has to be called y (not y.rs, y). Humorously, Rust will overwrite the source with the binary! At least on my machine, the binary does work after that though.

Rust, 37 chars (+ equivalent of env K='y' on your platform)

fn main(){loop{println!(env!("K"))}}

This one is even worse: you need to set the environment variable K to y at compile time.

Edit: if you set K to y\n, you could drop the ln in println!, for a grand total of 35 chars and several facepalms:

fn main(){loop{print!(env!("K"))}}

Haskell, 29 bytes

main=putStrLn[succ 'x']>>main

I believe this is stopped by both SIGINT and SIGPIPE.

Linux Bash, 33-10 = 23

read a; while :; do echo $a; done

Can be killed with SIGINT by pressing Ctrl+C.

PowerShell, 27 − 10 = 17

param($s=$Host[1])for(){$s}

Might not work in Pash. A more robust alternative should be

param($s="$(gal gh*)"[2])for(){$s}

CJam, 13 bytes - 10 = 3

l_'x)?{_oNo}h

You'll need to use the Java interpreter for this, because the online interpreter only returns once the program terminates.

You can abort the program with SIGINT (by pressing Ctrl-C). It will read a line from STDIN, and print that line, or y if the input was empty.

Explanation

l             "Read line from STDIN.";
 _            "Duplicate.";
  'x          "Push character x.";
    )         "Increment to get y.";
     ?        "Ternary operator. Replaces line with y if it was empty.";
      {    }h "Repeat while true. Leaves condition on the stack, which is the output string.";
       _o     "Duplicate line and print.";
         No   "Push string with newline and print.";

After clarification of the OP, the following seems more to spec:

l{_o9c)o1}g

I'll wait with updating the submission until the OP replies to my comment, though.

Marbelous 14 bytes

0978
]]/\++
!!

This is pretty straightforward, the '/\' device places two copies on its left and right, the right one is incremented by ++ and then falls off the board and is printed. The ]] device pushes any marble to the right if STDIN is empty but lets the first byte on STDIN fall down if it isn't. This will then trigger the !! device, which exits the board. So this will print y\n until you enter anything on stdin.

This only works in the python interpreter.

Brainfuck - 38 bytes

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

It doesn't use 10 or 121, because +-<>.,[] are all the meaningful characters in the language anyway, but it does calculate them pretty naively (0+1+1+1+1+1+1+1+1+1+1=10, 10*12+1=121).

This probably depends on the interpreter, but it dies to ^C on my machine.

Brainfuck - (63-10)=53

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

Apparently this isn't totally portable. My sys.version is 2.7.9 (default, Dec 11 2014, 04:42:00) \n[GCC 4.9.2], so if yours is different this might not work I guess.

Python 2 - (76-10)=66

import sys
s=sys.stdin;a=`help`[1]if s.isatty()else s.read()
while 1:print a

Pretty long, but I wanted to go for the bonus (even though it cost more than 10 bytes). Checking if stdin is empty or not without prompting for input is long, apparently.

At first, I misread the bonus as taking an argument instead of stdin. I'm proud of my solution for that, so I'm posting it anyway ;)

Python 2 - (52-10+∞)=∞ (invalid!)

import sys
while 1:print(sys.argv+[0])[1]or`help`[1]

sys.argv is a list where the zeroth element is the filename and every element afterwords is an argument given to the program. I add a falsey value to the end of the list; if there are no arguments, the first element is that falsey value, otherwise it's the first argument. a or b in Python returns the first value that confirms what the outcome will be: If a is truthy, we already know that the whole thing will be true, so it just gets returned. If it's false, b is returned (since False or b == b).

Ruby, 30 23 18 bytes

loop{puts ?x.succ}

Can be killed with SIGINT by pressing Ctrl+C.

Thanks to manatwork for sharing improvements!