Question about fast enumeration


#1

Edit: problem solved! typo… :blush:

Wow, this challenge took me way longer than I expected.

One (of many) problems was with fast enumeration. When I did it the slow way, it worked, but the fast way still don’t. What am I doing wrong?

//this works
NSUInteger stockCount = [myStock count];
        
        for  (int i = 0; i< stockCount; i++) {
        StockHolding *s = [myStock objectAtIndex:i];

        NSLog(@"current value of %@  is %.2f ", [s shareName], [s valueInDollars]);   
        }

THis don’t:


        
        for (Stockholding *s in myStock) {
        
            NSLog(@"current value of %@  is %.2f ", [s shareName], [s valueInDollars]);
           
        }

And I don’t understand why not.