• 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: Variable declarations within message body?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable declarations within message body?


  • Subject: Re: Variable declarations within message body?
  • From: Nathan Day <email@hidden>
  • Date: Sun, 12 May 2002 21:48:03 +0930

On Sunday, May 12, 2002, at 09:40 PM, Ila'n Terrell wrote:

I am working through the BNR Cocoa book by Aaron Hillegass. I have just completed a "Challenge" and came across this question:
In this message:
[outputField setStringValue:[NSString stringWithFormat:@"%@ has %d characters",[inputField stringValue], num]];

would it have been possible to declare and initialized the value that is stored in num within the body of the message? so far, I have declared and initialized num on it's own:

int num = [[inputField stringValue] length];

This syntax works fine, but I am always looking for ways to type less code in....

do you mean like this.

[outputField setStringValue:[NSString stringWithFormat:@"%@ has %d characters",[inputField stringValue], [[inputField stringValue] length]]];
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Variable declarations within message body? (From: "Ila'n Terrell" <email@hidden>)

  • Prev by Date: Re: Standard C functions in Objective-C?
  • Next by Date: Re: Standard C functions in Objective-C?
  • Previous by thread: Variable declarations within message body?
  • Next by thread: SymLink and FSPathMakeRef
  • Index(es):
    • Date
    • Thread