• 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: Return acting like break in XCode 3.2.2
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Return acting like break in XCode 3.2.2


  • Subject: Re: Return acting like break in XCode 3.2.2
  • From: Greg Guerin <email@hidden>
  • Date: Tue, 25 May 2010 07:05:23 -0700

Andrei Freeman wrote:

Given the following code: (Please note there are some pseudocode liberties taken)

NSArray *myArray  = somePre-established array;
NSString *aString = nil;
NSEnumerator *anEnum = [myArray objectEnumerator];

while ((aString = [anEnum nextObject])) {
  if ([aString isEqualToString:@StringThatMatchesObjectIndex(0)]) {
    return aString;
  }
return nil;


Maybe it's one of your pseudo-code liberties, or maybe it's a real bug, but you have two open braces '{' in the code, yet only one close- brace '}'. As a result, the return nil; statement is in the body of the while loop and will always be executed when the body of the if statement is not.

Your second code fragment has the same problem.

Consider posting real code instead of pseudo-code. One problem with pseudo-code is no one knows if it will compile. Compilation would probably show a syntax error with a missing brace. But without knowing which parts of what you posted are real and which are pseudo, all anyone can do is guess.

  -- GG

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Break on ivar value change
  • Next by Date: Re: Memory Browser Font
  • Previous by thread: Re: Return acting like break in XCode 3.2.2
  • Next by thread: [ANN] PackageMaker 3 Step-by-Step instructions
  • Index(es):
    • Date
    • Thread