Login
|
Signup
langref.org
-
perl
,
cpp
,
csharp
, and
clojure
add..
all
erlang
fantom
fsharp
go
groovy
haskell
java
ocaml
php
python
ruby
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
perl
pop @list;
pop @list;
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);
}
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);
clojure
(pop ["Apple" "Banana" "Carrot"])
(pop ["Apple" "Banana" "Carrot"])
Submit a new solution for
perl
,
cpp
,
csharp
, or
clojure
There are 20 other solutions in
additional
languages (
erlang
,
fantom
,
fsharp
,
groovy
...)