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

C# array code challenge

Hey guys any help given would be appreciated, cant seem to get the last part of the code right. Thanks

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

lapTimes[0] = 2.2;

double[] finalLapTimes = new double[4] {2.2,2.3,2.5,2.8};

double lap3 = finalLapTimes[3]

2 Answers

Good job! You are really close.

in this line u can find the problem :

double lap3 = finalLapTimes[3]

you need to assign lap3 to the third item in the array. how u access element in array in c# >> by their index!. so you want to access the THIRD element which is in INDEX 2 since array start in INDEX 0.

so the solution is:

double lap3 = finalLapTimes[2]

thanks bro I appreciate it, worked well