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 Build a Simple iPhone App (iOS7) Refactoring into a Model Understanding @property

Andrew Nguyen
Andrew Nguyen
2,470 Points

Why do we use _prediction in the nil check instead of self.prediction?

For the interface file we just made a property that makes a setter and getter. However, in the implementation we implement a getter, however, when we do the nil check on the predictions array why do we use _predictions instead of self.predictions?

1 Answer

Hello Andrew,

the answer is, either one works it's normally just convention to use _ as apposed to self. when making a getter method but self. works the same in this example.

Kai