myArray = [NSArray arrayWithObjects:aDate, aValue, aString, nil];
This array convenience method takes a comma-separated list of objects ending with nil.
What is the purpose of the nil?
myArray = [NSArray arrayWithObjects:aDate, aValue, aString, nil];
This array convenience method takes a comma-separated list of objects ending with nil.
What is the purpose of the nil?
Null terminated variable argument lists, or valists, keep walking the list of arguments until it encounters a placeholder or sentinel, which is nil.
Since the method has no way of knowing how many arguments you are passing, it needs the sentinel (nil) to tell where the list ends.
To mark the end of the list of objects.
Here's a discussion from CocoaBuilder.