Login
|
Signup
langref.org
-
ruby
,
cpp
, and
fantom
add..
all
clojure
csharp
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
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);
}
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
}
}
Submit a new solution for
ruby
,
cpp
, or
fantom
There are 19 other solutions in
additional
languages (
clojure
,
csharp
,
erlang
,
fsharp
...)