Login
|
Signup
langref.org
-
python
,
clojure
,
csharp
,
erlang
...
add..
all
cpp
fantom
fsharp
groovy
haskell
java
ocaml
perl
php
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Lists
Declaration
Define a static list
Define the list
[One, Two, Three, Four, Five]
python
list = ['One', 'Two', 'Three', 'Four', 'Five']
print list
list = ['One', 'Two', 'Three', 'Four', 'Five']
print list
clojure
(def a '[One Two Three Four Five])
(def a '[One Two Three Four Five])
csharp
IList<string> list = new string[]{"One","Two","Three","Four","Five"};
IList<string> list = new string[]{"One","Two","Three","Four","Five"};
erlang
List = [one, two, three, four, five],
-module(statlist).
-export([start/0]).
start() ->
List = [one, two, three, four, five],
io:format("~B~n", [length(List)]).
erlang
List = ['One', 'Two', 'Three', 'Four', 'Five'],
-module(statlist).
-export([start/0]).
start() ->
List = ['One', 'Two', 'Three', 'Four', 'Five'],
io:format("~B~n", [length(List)]).
go
var l = []string{"One", "Two", "Three", "Four", "Five"}
package main
import "fmt"
func main() {
var l = []string{"One", "Two", "Three", "Four", "Five"}
fmt.Printf("len(%d) cap(%d)\n", len(l), cap(l))
fmt.Printf("%#v\n", l)
}
Submit a new solution for
python
,
clojure
,
csharp
,
erlang
...
There are 30 other solutions in
additional
languages (
cpp
,
fantom
,
fsharp
,
groovy
...)