Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Bryan Beasman
Bryan Beasman
3,435 Points

Append vs Concatenation

Right now I am learning about adding items to an array in swift. I have learned that one can add elements to the end of an array using the append method and also by concatenating 2 arrays together. Why does the append method exist if I can just concatenate? I am trying to figure out which method of adding elements to an array I should use more often moving forward, but they both seem like they do the same exact thing.

1 Answer

Hi Bryan,

Yup: both those methods do exactly the same thing. So, it doesn't matter which one you use. Just pick one ;)