Logo

Programming-Idioms

Remove the last element from the list items.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
with Ada.Containers.Vectors;
Items.Delete_Last (Count => 1);
(drop-last items)
items.pop_back();
items.RemoveAt(items.Count - 1);
items.removeLast();
items = items(1:size(items)-1)
items = items[:len(items)-1]
import "slices"
items = slices.Delete(items, len(items)-1, len(items))
pop :: [a] -> [a]
pop [] = []
pop xs = init xs

let items2 = pop items
let items2 = init items
items.pop();
import java.util.List;
items.remove(items.size() - 1);
items.removeLast();
import static java.util.Arrays.copyOfRange;
items = copyOfRange(items, 0, items.length - 1);
import static java.lang.System.arraycopy;
int n, t[] = new int[n = items.length - 1];
arraycopy(items, 0, t, 0, n);
items = t;
array_pop($items);
uses Classes;
items.delete(items.count-1);
pop(@items);
items.pop()
items.pop
items.pop();