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

iOS

How 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

So 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];

@Ahmed Nini

I got it,thanks :)

You are welcome. I'm glad I could help.