Some concise implementations of yes I wrote for fun with the goal of using as few characters as possible.
Run using scala yes.scala
to output "y" until killed or scala yes.scala mystring
to output "mystring" until killed. To kill the process, hit Ctrl-C.
The easiest way to test this is to paste the contents of yes.js into your web browser console. Doing this defines a function, y. Then you can type y()
to output "y" repeatedly or y("mystring")
to output "mystring" repeatedly.
A classic programming interview question. Print the numbers from 1-100. But, for numbers divisible by 3, print "Fizz" instead of the number. For numbers divisible by 5, print "Buzz" instead of the number. For numbers divisible by both 3 and 5, print "FizzBuzz".
Just run the program in a browser console or node. There are no functions to call.