Re: Variable declarations within message body?
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.