Lab42.Html v0.1.3 Lab42.Html.Tool View Source

Link to this section Summary

Functions

By default we will number a list starting with 1 and increment by the same value

Link to this section Functions

Link to this function

numbered(list, options \\ [])

View Source

By default we will number a list starting with 1 and increment by the same value

  iex(0)> numbered(~w[a b c])
  [{1, "a"}, {2, "b"}, {3, "c"}]

However one or both of these default values can be changed

  iex(1)> numbered(~w[alpha beta gamma]a, start: 40)
  [{40, :alpha}, {41, :beta}, {42, :gamma}]

  iex(2)> numbered(~w[three one minus_one], start: 3, increment: -2)
  [{3, "three"}, {1, "one"}, {-1, "minus_one"}]