Challenge
Your challenge is to add this code to the end of your project and implement the TOODs:
NSMutableArray *favoriteFood = [NSMutableArray
arrayWithObjects:@"Pizza", @"Sushi", @"Toe Jam", @"Yellow Snow", nil];
// TODO 1: Convert to use literal syntax
// TODO 2: Remove any non-favorite food
// TODO 3: Add at least 1 new favorite food
// TODO 4: Iterate through list and print out each item (use for loop and literal syntax)
Download demo code
Download challenge solution
Helpful links
Errata
- At 12:45, when discussing literal syntax, I say “and you don’t have to put nil”. For clarifiation, it’s an error if you *do* put nil. It won’t compile if you put plain nil, and if you try casting nil to a type, it will compile but crash at runtime.