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 trialEdwin Mhoy Silva Rifa
2,631 PointsWhat is the difference between append and insert? - and when too use them?
Help med pls
2 Answers
Alan Johnson
7,625 Pointsappend
always places the item at the end of the array, whereas insert
places it at the given position within the array. You could certainly insert
to the end of the array as well.
Here's a quick example that you can toss into a playground:
var arr = ["Zero", "Two"]
arr.insert("One", atIndex: 1)
arr
arr.append("Three")
arr
arr.insert("Four", atIndex: 4)
arr
Edwin Mhoy Silva Rifa
2,631 PointsThank you - Iยดm just asking, and hope you could answer :)
- Do you thing its hard too make an app, and how long would it take to learn it :) ?
Myers Carpenter
6,421 PointsIt depends on what you want your app do to. We have courses on to make two different apps with Swift.
Edwin Mhoy Silva Rifa
2,631 PointsEdwin Mhoy Silva Rifa
2,631 PointsThank you :)
Alan Johnson
7,625 PointsAlan Johnson
7,625 PointsSure thing, Edwin. Happy learning!