Re: Objects Not being added to array
Re: Objects Not being added to array
- Subject: Re: Objects Not being added to array
- From: Andrew Farmer <email@hidden>
- Date: Sat, 16 Dec 2006 23:35:28 -0800
On 16 Dec 06, at 23:24, Matthew Callis wrote:
Thanks Nick & Andrew! That fixed the math problem, and for time's
sake I
haven't changed to keyed values yet, but the main problem still
exist that
the first item in my array isn't added due to flawed logic that I
can't seem
to figure out in Objective-C that was done in C++.
<snipped code>
As far as I can tell, it's behaving as written. I'm not quite sure
what you're trying to do (removing duplicates?), but right now, it's
comparing the first item to itself on the first time through the
loop, which is kind of a foregone conclusion. You probably want to
special-case the first item: change the if() statement to
if(artistResult != NSOrderedSame || venueResult != NSOrderedSame
|| i == 0)
Note also that I'm using a symbolic constant, NSOrderedSame, instead
of the "magic number" 0. This doesn't affect the way your code works,
but it's a good habit to get into.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden