Login
|
Signup
langref.org
-
ruby
,
erlang
,
csharp
, and
fsharp
add..
all
clojure
cpp
fantom
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
Declaration
Define an empty list
Assign the variable
"list"
to a list with no elements
ruby
list = []
list = []
ruby
list = Array.new
list = Array.new
erlang
List = [],
-module(emptylist).
-export([start/0]).
start() ->
List = [],
io:format("~B~n", [length(List)]).
csharp
3
var list = new List<object>();
using System.Collections.Generic;
class SolutionXX
{
static void Main()
{
var list = new List<object>();
}
}
fsharp
let list = []
#light
open System
let list = []
fsharp
let list = List.empty
#light
open System
// True 'list' created - equivalent to []
let list = List.empty
fsharp
let list = new Generic.List<string>()
#light
open System
open System.Collections
// .NET 'Generic.List' is actually an array type, and is aliased in f# as 'ResizeArray<T>'
let list = new Generic.List<string>()
fsharp
let list = new Generic.LinkedList<string>()
#light
open System
open System.Collections
// .NET 'Generic.LinkedList' is a node-based, list-like structure, though not a true f# 'list'
let list = new Generic.LinkedList<string>()
Submit a new solution for
ruby
,
erlang
,
csharp
, or
fsharp
There are 18 other solutions in
additional
languages (
clojure
,
cpp
,
fantom
,
go
...)