Re: Why add a nil item to an NSArray ?
Re: Why add a nil item to an NSArray ?
- Subject: Re: Why add a nil item to an NSArray ?
- From: Glen Simmons <email@hidden>
- Date: Mon, 27 Jun 2005 14:37:54 -0500
On Jun 27, 2005, at 2:08 PM, Martin Ottenwaelter wrote:
Hi,
Why doesn't that works :
[NSArray initWithObjects:@"First",@"Second"];
Why do I have to add that nil item for the NSArray to be ok ?
[NSArray initWithObjects:@"First",@"Second",nil];
You're not adding nil to the array, you're letting the method know
that your list is complete. Underneath, the method is iterating
through the list until it finds nil. If it doesn't, it runs off the
end and Bad Things happen.
Glen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden