Login
|
Signup
langref.org
-
ruby
,
csharp
,
fantom
, and
cpp
add..
all
clojure
erlang
fsharp
go
groovy
haskell
java
ocaml
perl
php
python
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Lists
Modification
Remove the last element of a list
ruby
list = ['Apple', 'Banana', 'Carrot']
list.delete_at(-1)
list = ['Apple', 'Banana', 'Carrot']
list.delete_at(-1)
ruby
list = ['Apple', 'Banana', 'Carrot']
list.pop
list = ['Apple', 'Banana', 'Carrot']
list.pop
csharp
List<string> fruits = new List() { "apple", "banana", "cherry" };
fruits.RemoveAt(fruits.Length - 1);
List<string> fruits = new List() { "apple", "banana", "cherry" };
fruits.RemoveAt(fruits.Length - 1);
fantom
list := ["Apple", "Banana", "Carrot"]
list.removeAt(-1)
class SolutionXX
{
Void main()
{
list := ["Apple", "Banana", "Carrot"]
list.removeAt(-1)
}
}
fantom
list := ["Apple", "Banana", "Carrot"]¨
list.pop
class SolutionXX
{
Void main()
{
list := ["Apple", "Banana", "Carrot"]¨
list.pop
}
}
cpp
C++/CLI .NET 2.0
fruit->RemoveAt(fruit->Count - 1);
using namespace System;
using namespace System::Collections;
int main()
{
array<String^>^ input = {"Apple", "Banana", "Carrot"};
Generic::List<String^>^ fruit = gcnew Generic::List<String^>((Generic::IEnumerable<String^>^) input);
fruit->TrimExcess();
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
...)