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

Set the first double in the array to 2.2

just not getting this... I understand I need to include the index number between the brackets, but keep trying the different brackets to make this work and just not understanding this

CodeChallenge.cs
double[2.2] lapTimes[] = new double[4] lapTimes[2.2]; 

1 Answer

Steve Agusta
Steve Agusta
6,221 Points

It looks like you've got the concept of declaring the array, but the syntax for the declaration and initialization are not quite right. let's look at the array declaration first. How would you write that on its own, to declare an array of doubles with a length of 4?

double[] lapTimes = new double[4]; lapTimes[0] = 2.2;

Thanks Steve for the help!!