Elixir LanguageLists

Download Elixir Language for free

Syntax

  • []
  • [1, 2, 3, 4]
  • [1, 2] ++ [3, 4] # -> [1,2,3,4]
  • hd([1, 2, 3, 4]) # -> 1
  • tl([1, 2, 3, 4]) # -> [2,3,4]
  • [head | tail]
  • [1 | [2, 3, 4]] # -> [1,2,3,4]
  • [1 | [2 | [3 | [4 | []]]]] -> [1,2,3,4]
  • 'hello' = [?h, ?e, ?l, ?l, ?o]
  • keyword_list = [a: 123, b: 456, c: 789]
  • keyword_list[:a] # -> 123

Related Examples

Char Lists