Challenge 1 side-question


#1

Hi, working on challenge 1, I was able to create the array and use enumeration to print it out, but my grocery list had a two-word item (paper towels) and it printed out the array as below:
milk,
beans,
“paper towel”,
yogurt

Can someone tell me why the " " around paper towels?
Code below:

int main(int argc, const char * argv[])
{
NSMutableArray *list = [[NSMutableArray alloc] initWithObjects:@“milk”, @“beans”, @“paper towels”, @“yogurt”, nil];
for(NSString *x in list){
NSLog(@“On the list: %@”, list);
}
return 0;
}


#2

.
.
.
NSMutableArray *list = [[NSMutableArray alloc] initWithObjects:@“milk”, @“beans”, @“paper towels”, @“yogurt”, nil];
.
.
.

You r using the “initWithObjects:” method, check its reference.
Or use “arrayWithObjects:” method.


#3

Also, I think because your NSLog is using list rather than x.

Here is my code:

[code]#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
@autoreleasepool {
NSMutableArray *foodList = [NSMutableArray array];
[foodList addObject:@“Loaf of bread”];
[foodList addObject:@“Container of milk”];
[foodList addObject:@“Stick of butter”];

    NSLog(@"My grocery list is:");
    for (NSString *f in foodList) {
        NSLog(@"%@", f);
    }
}
return 0;

}
[/code]