View Problem

Remove the last element of a list

DiskEdit
ruby
list = ['Apple', 'Banana', 'Carrot']
list.delete_at(-1)
DiskEdit
ruby
list = ['Apple', 'Banana', 'Carrot']
list.pop
DiskEdit
csharp
List<string> fruits = new List() { "apple", "banana", "cherry" };
fruits.RemoveAt(fruits.Length - 1);
ExpandDiskEdit
fantom
list := ["Apple", "Banana", "Carrot"]
list.removeAt(-1)
ExpandDiskEdit
fantom
list := ["Apple", "Banana", "Carrot"]¨
list.pop
ExpandDiskEdit
cpp C++/CLI .NET 2.0
fruit->RemoveAt(fruit->Count - 1);

Submit a new solution for ruby, csharp, fantom, or cpp
There are 18 other solutions in additional languages (clojure, erlang, fsharp, groovy ...)