View Problem

Define an empty list

Assign the variable "list" to a list with no elements
DiskEdit
ruby
list = []
DiskEdit
ruby
list = Array.new
ExpandDiskEdit
java
List list = Collections.emptyList();
ExpandDiskEdit
java
String[] list = {};
DiskEdit
perl
@list = ();
DiskEdit
groovy
list = []
DiskEdit
groovy
// if a special kind of list is required
list = new LinkedList() // java style
LinkedList list = [] // statically typed
// using 'as' operator
list = [] as java.util.concurrent.CopyOnWriteArrayList

ExpandDiskEdit
scala
val list = Nil
ExpandDiskEdit
scala
val list = List()
ExpandDiskEdit
scala
val list : List[String] = List()
ExpandDiskEdit
scala
val list = List.empty
DiskEdit
python
list = []
ExpandDiskEdit
cpp C++/CLI .NET 2.0
Generic::List<String^>^ list = gcnew Generic::List<String^>();
ExpandDiskEdit
cpp
std::list<std::string> list;
ExpandDiskEdit
fsharp
let list = []
ExpandDiskEdit
fsharp
let list = List.empty
ExpandDiskEdit
fsharp
let list = new Generic.List<string>()
ExpandDiskEdit
fsharp
let list = new Generic.LinkedList<string>()
ExpandDiskEdit
erlang
List = [],
DiskEdit
ocaml
let list = [];;
ExpandDiskEdit
csharp 3
var list = new List<object>();
ExpandDiskEdit
php
$list = array();
DiskEdit
haskell
let list = []
DiskEdit
clojure
(list)
DiskEdit
clojure
'()
ExpandDiskEdit
fantom
list := [,]
ExpandDiskEdit
go
var l []string;

Submit a new solution for ruby, java, perl, groovy ...