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 trialJeffrey Lawlis
374 PointsNSString Task 3 incorrect value assigned to *favorite
Here is what I have. I've tried mixing all the variables into different locations and haven't been able to find something that will work. I guess I'm a little unclear on the syntax. I basically copied the videos NSString *concat = [[alfa stringByAppendingString:delta] stringByAppendingString:@"lotsmore"]; Follow up question: How did the instructor initialize "lotsmore" without declaring a NSString?
2 Answers
Jeffrey Lawlis
374 Points;
Tom Schouteden
1,850 PointsYou're using double square brackets where you should only have single square brackets: [preference stringByAppendingString:color]
Follow-up answer: the @ sign is a convenience notation for [NSString ...]
Jeffrey Lawlis
374 PointsJeffrey Lawlis
374 PointsForgot to actually include what I have. Here it is...
NSString *color = @"Purple"; NSString *preference = @"My favorite color is "; NSString *favorite = [[preference stringByAppendingString:color]];