using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlowControl
{
    class Examples55_56
    {
        public static void WhileLoop()
        {
            // Listing 2-55
            using (var reader = new StreamReader(@"..\..\Program.cs"))
            {
                while (!reader.EndOfStream)
                {
                    Console.WriteLine(reader.ReadLine());
                }
            }
        }

        public static void DoLoop()
        {
            // Listing 2-56
            char k;
            do
            {
                Console.WriteLine("Naciśnij x, aby zakończyć.");
                k = Console.ReadKey().KeyChar;
            }
            while (k != 'x');
        }
    }
}
