DEV Community

Discussion on: Challenge: Write a program that never stops

Collapse
 
andreasjakof profile image
Andreas Jakof

C#

class Program
{
   public static IEnumerable<string> HelloWorld()
   {
      while(true) yield return Hello World;
   }
   public static void Main(string[] args)
   {
      foreach (string  s in HelloWorld())
      {
         Console.WriteLine(s);
         Thread.Sleep(1000);
      }
   }
}