• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: for Loop Error or Logical Error?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: for Loop Error or Logical Error?


  • Subject: Re: for Loop Error or Logical Error?
  • From: "Matthew Callis" <email@hidden>
  • Date: Sun, 24 Dec 2006 09:37:40 -0600

Where is the error? Every time I go through it, it seems like it's as it
should be based on my old Windows code. By adding weird OR additions with i
== some number at the end it starts adding them, but it doesn't count them
all or add up all the time.

On 12/23/06, Andrew Farmer <email@hidden> wrote:

On 23 Dec 06, at 12:23, Matthew Callis wrote: > I have a loop that is going through an array of sorted items and > making a > list of the unique items while counting the instances of them. The > error > occurs in that the last unique set of items in the array is not being > counted or listed, even though It IS in the array. The output > should have 3 > items, not 2. <snip>

Logical error. Walk through your code by hand and you'll see what's
going on.

By the way, you've improved things a bit since I last saw this code,
but you really ought to implement a few extra methods on the tape
object:

- (NSComparisonResult) compare:(Tape *)otherTape;
- (NSString *) tabDelimitedDescription;

Writing and using these properly should make this method a lot easier
to read and debug.






--
- Matthew
http://eludevisibility.org/
_______________________________________________

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


  • Follow-Ups:
    • Re: for Loop Error or Logical Error?
      • From: James Bucanek <email@hidden>
References: 
 >for Loop Error or Logical Error? (From: "Matthew Callis" <email@hidden>)
 >Re: for Loop Error or Logical Error? (From: Andrew Farmer <email@hidden>)

  • Prev by Date: Re: Adding Help to App
  • Next by Date: Re: for Loop Error or Logical Error?
  • Previous by thread: Re: for Loop Error or Logical Error?
  • Next by thread: Re: for Loop Error or Logical Error?
  • Index(es):
    • Date
    • Thread