Greetings!
I'm trying to iterate through two arrays, using one for loop, but whenever I try to print both array elements, I get an IndexOutOfBounds error. I've also tried using two different variables to keep track of the two array's indices, but that failed as well. Both of my methods are posted below.
And thisCode:for(int i = 0, j = 0; i < average.Length, j < high.Length; i++, j++){ Console.Write(" Week {0} -- {1}\t Week {2} -- {3}\n", (i + 1), average[i], (j+1), high[j]); }
Also, every time I post code here, I get multiple extra blank lines. How can I get rid of those? Thanks.Code:for (int i = 0; i < average.Length; i++) Console.Write(" Week {0} -- {1}\t Week {0} -- {2}\n", (i + 1), average[i], high[i]);