Buongiorno :)

Le 12 juil. 2010 à 09:34, Giannandrea Castaldi a écrit :

> I want to use blocks to extract the min price and the max price from
> an NSArray of trips. I've found the following way:
> 
>    float minValue = 0.0;
>    [someTrips enumerateObjectsUsingBlock:^(id obj, NSUInteger idx,
> BOOL *stop) {
>      if (minValue == 0.0 || [[obj adultFinalPrice] floatValue] < minValue) {
>        minValue = [obj floatValue];
>      }
>    }];

[…]

Did you test it? Does it work? I've always heard that you could not modify 
block external variables unless you prefix them with __block. Otherwise the 
variable is just a const reference. 

Buon proseguimento,
Vincent

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to