delete an element from an array

bearophile bearophileHUGS at lycos.com
Sun Oct 24 06:31:12 PDT 2010


Jonathan M Davis:

> Well, then use indexOf() to get the offset and remove() to remove the element.

But you must test the result value of indexOf, because it returns -1 (a signed value, probably an integer, not a signed word, so it may give troubles on 64 bit systems) when the item is missing. This is why Python has both a way to remove an item by index and by value.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list