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

namespace FlowControl
{
    class Examples57_59
    {
        public static void ForLoopModifyArray()
        {
            int[] myArray = Enumerable.Range(1, 10).ToArray();

            // Listing 2-57
            for (int i = 0; i < myArray.Length; i++)
            {
                myArray[i] *= 2;
            }
        }

        public static void MultipleForLoopVariables()
        {
            int[] myArray = Enumerable.Range(1, 10).ToArray();

            // Listing 2-58
            for (int i = 0, j = 0; i < myArray.Length; i++, j++)
            {
                Console.WriteLine(i + ", " + j);
            }
        }

        public static void NestedForLoops()
        {
            int width = 4;
            int height = 3;

            for (int j = 0; j < height; ++j)
            {
                for (int i = 0; i < width; ++i)
                {
                    Console.WriteLine(i + ", " + j);
                }
            }
        }
    }
}
