[Swift-user] last element array indexing?

Ben Clifford benc at hawaga.org.uk
Sun Mar 21 17:55:48 CDT 2010


> How can I refer to the last element of the array?  my external mapper 
> doesn't know beforehand how many elements it will give the array.

Not at all answering your question but maybe giving some information that 
makes it even harder ;)

Although array indices must be integers (or perhaps numbers in general), 
there is no constraint that there are elements at any particular location. 
You can have an array containing values for f[3] and f[92]. So that has 2 
elements, and the last element has index 92. mmm.

I don't think there's much use for this 'feature', but there it is.

-- 
http://www.hawaga.org.uk/ben/




More information about the Swift-user mailing list