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
zou su
Courses Plus Student 744 PointsHow to add the following strings to the ‘elements’ array: 'Helium','Neon', 'Argon' at a time
NSMutableArray *elements = [NSMutableArray array];
Sorry for the post.I think I already know.
[elements addObject:@"Helium"]; [elements addObject:@"Neon"]; [elements addObject:@"Argon"];
3 Answers
Ahmed Nini
2,047 PointsSo your solution above lists three lines of code even if you do write them in one. If you wanted to do all at once, you could do:
elements = [NSMutableArray arrayWithObjects:@"Helium", @"Neon", @"Argon", nil];
zou su
Courses Plus Student 744 Points@Ahmed Nini
I got it,thanks :)
Ahmed Nini
2,047 PointsYou are welcome. I'm glad I could help.