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 trialErik Hainer
3,049 PointsMultiple Error CS1525
How do I call a specific item from an array? I'm honestly not sure how to do it without setting an index variable first, and even then im not sure how to use that index variable :(
1 Answer
Mark Sebeck
Treehouse Moderator 38,004 PointsHi Erik. To get an element in an array you just use [element number]. So if you have an array called sequence and want the first element it would be sequence[0] (remember in C# arrays start at 0) The second element would be sequence[1] and the third would be sequence[2]
Most of the time when dealing with arrays you would use a for loop. so something like:
for(int i=0;i<sequence.Length;i++) {
sequence[i] .......
}
Hope that helps. Post back to the Community if you are still stuck
Erik Hainer
3,049 PointsErik Hainer
3,049 PointsHi It helped but now im getting some other errors that make no sense. I'll post and ask for help again haha. Thank you!