In the past I have used the construct
NSEnumerator *_enumerator = [_array objectEnumerator];
id _id = nil;
while (nil != (_id = [_enumerator nextObject])) {
.
.
.
if (condition)
break;
}
if (nil == _id) {
.
.
.
}
to determine if the entire contents of _array had been investigated and, if
not, which object in _array met the condition.
When trying to use, instead,
for (id _id in _array) {
}
how, without reverting to effectively using an enumerator as in
id theID = nil;
for (id _id in _array) {
.
.
.
if (condition) {
theID = _id;
break;
}
.
.
.
if (nil != theID) {
.
.
.
}
does one accomplish the same thing?
Charlie Dickman
[email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]