Hello, I’m working on this task:
Create a new list of type string named animals with the following animals as strings: “Wolf”, “Fish”, “Elephant”, “Dog”.
Output the values of every cell in the list to the console, each on a new line using a for loop.
Here is my code:
using System;
using System.Collections.Generic;
namespace Lists
{
public class ListsAnimals
{
static void Main(string[] args)
{
// List<string> animals = new List {“Wolf”, “Fish”, “Elephant”, “Dog”};
List <string> animals = new List<string> {"Wolf", "Fish", "Elephant", "Dog"};
for (int i= 0; i < animals.Count; i++)
{
Console.WriteLine(animals[i]);
}
}
}
}
I’m confused why it won’t say it’s solved even though the output is correct.