Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Ruby

Idiom #29 Remove item from list, by its index

Remove i-th item from list items.
This will alter the original list or return a new list, depending on which is more idiomatic.
Note that in most languages, the smallest valid value for i is 0.

items.delete_at(i) 

A negative value for i is also valid, -1 refering to the last element from items, -2 to the item before the last.
with Ada.Containers.Vectors;
use Ada.Containers;
Items.Delete (I);

New implementation...
< >
programming-idioms.org