How do I fix "System.String[]" Error in C# ? (using arrays + For loop)

arrays, c#, for-loop, loops

Solution

You have to print a value inside the array, not the array itself.

use `sDays[iDays]` instead. This will retrieve the value at location `iDays` in the array `sDays`.

Problem

Okay so, I'm trying to make a program that basically uses a for loop to display the days of the week, my code seems fine, runs fine, but when I happen to run it.. it comes up "The day of the week is System.String[]".. Whereas I want it to display The day of the week is Monday... The day of the week is Tuesday... Wednesday.. Etc. Here is the code I have written for this so far: ``` //Declare variables int iDays; //Declare array const int iWEEK = 7; string[] sDays = new string[iWEEK] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; //Display the days of the week for (iDays = 0; iDays < iWEEK; iDays++) { Console.WriteLine("The day of the week is " + sDays); } //Prevent program from closing Console.WriteLine(); Console.WriteLine("Press any key to close"); Console.ReadKey(); ```

Original source