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 with Objective-C Creating a Data Model Creating a Data Collection

Unclear as to underscore requirement?

In the third part of this challenge, the assignment is to pick out an item from the array shoppingList and assign it to NSString shoppingCart.

self.shoppingCart= [_shoppingList objectAtIndex:2];

I only discovered this because I got close enough to this syntax that the editor itself told me what was missing. Is this challenge supposed to be a lesson in using the editor? I know underscore is used at times in methods, but that wasn't covered in ANY lesson up to this point. What the hell?

When do I use underscore? In the video, the closest usage,

self.funFactLabel.text = [facts objectAtIndex:1];

DOES NOT USE THIS!

ViewController.h
#import "UIViewController.h"

@interface ViewController : UIViewController

@property (strong, nonatomic) NSString *shoppingCart;

@end
ViewController.m
#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    // Add your code below!
}

@end

Pardon inclusion of code. Forgot to uncheck 'include code' box. It isn't necessary to my question.

1 Answer

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

Whenever I see underscores it doesn't make a difference as to how the code works in this context, I could have funFacts just as easily as fun_Facts, I don't know why it's in the code challenge though.