Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Objects Encapsulation and Arrays Arrays

Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points

i'm not sure what to do here

I've kept on trying to work out what I did wrong but I can't crack the code. Help requested.

CodeChallenge.cs
namespace Code
{
    class code
    {

      string[] laptimes = new string[4];


    }


}

6 Answers

There is no need for a namespace or class.

Instructions are: Declare an array of doubles named lapTimes of length 4.

Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points

i just have one more error : Did you declare the array to be of type 'double'?

var double[] lapTimes; string[] lapTimes = new string[4];

No need for the keyword var and an array of type double cannot be assigned a new array of type string

Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points

now I have this error : StudentsCode.cs(8,10): error CS0128: A local variable named `lapTimes' is already defined in this scope Compilation failed: 1 error(s), 0 warnings

code: double[] lapTimes; string[] lapTimes = new double[4];

double[] lapTimes = new double[4];

That is the only code you need to do.

As an explanation inline you are writing:

arrayType[] variableName = new arrayType[arrayLength]

Does that make sense?

Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points

thanks I also realized that i have spelt the variable wrong