[Fixed] Instantiating an array in C# course

Hello everyone!

I’ve been recently learning C# with the codecademy course. Had some minor issues with it on the way and just found another one, I think.


At the beginning of arrays lesson the Learn tab says we can instantiate an array in two ways:

int numbers = {1, 2, 3, 4};
int numbers = new int {1, 2, 3, 4};

And in the course it says both are perfectly fine and that we will learn the difference in detail later on. I think it has even been suggested slightly that if you don’t have to use the second method the first is the one to go.

So then there is a task to instantiate a new array. But the learn tab only accepts it if I use the second method even though it has just told me that both are fine. And I believe it’s not an issue with the code, since it compiles.

Should it be like that and after all I should be default use the second method or is it a mistake on the course part?

Wanted to put it in the bug reporting forum but I can’t add a New Topic there.

Thanks for any help in claryfing the issue.


1 Like

Hi there!

I’ve taken a look at the exercise, and I think the issue is one of vocabulary.

Specifically, task #1 asks you to initialise a string array called summerStrut. However, looking at the example solution to the lesson, it would appear they’re expecting you to declare the array first and initialise it later:

static void Main(string[] args)
      string[] summerStrut;
      summerStrut = new string[] {"Juice", "Missing U", "Raspberry Beret", "New York Groove", "Make Me Feel", "Rebel Rebel", "Despacito", "Los Angeles"};

As such, I think the first task ought to read “declare a string array” and not “initialise a string array”.

My thought that the lesson is expecting you to do the declaration and initialisation on two different lines seems to be supported by the error you get if you fail at Step 2:


If you’re declaring the variable and assigning it a value on a later line, as seems to be the expectation, you have to use the new keyword as explained in the lesson:


I think this is an error in the wording of the task. I’ll relay it to Codecademy, see what they think.

Thanks for flagging this up! (I’ll move your thread to the Bug Reporting section also. :slight_smile: )

Thanks @wiktorgaukievichmarc for reporting this and thanks @thepitycoder for investigating!

We’ve fixed the wording and the checkpoint feedback to specifically ask to declare an array in the first checkpoint, then initialize the array on a new line in the second checkpoint.

Screen Shot 2020-04-13 at 6.06.44 PM

1 Like