Hacker News new | ask | show | jobs
by Pharylon 3684 days ago
No loops, no sequence, one horrific line. :)

    Console.Write(String.Join("\r\n",  Enumerable.Range(1, 100).Select(x => x % 15 == 0 ? "FizzBuzz" : x % 5 == 0 ? "Buzz" : x % 3 == 0 ? "Fizz" : x.ToString())));
2 comments

There's a hidden loop in Enumerable.Range(), and quite possibly another one in String.Join(). Just because you avoided an explicit loop doesn't mean there isn't one (for example, an "if" statements has an implicit GOTO).
Ternaries aren't super readable.

  Array.from(Array(100).keys()).map(k => k + 1).map(i => !(i % 15) && 'fizbizz' || !(i % 5) && 'buzz' || !(i % 3) && 'fizz' || i)
No need for ternaries!

    Array.from(Array(100).keys()).map(k => k + 1).map(i => [i,'Fizz','Buzz','FizzBuzz'][!(i%3)+2*!(i%5)])