Overview
IntegrationsPricing

Lists

The examples in this document share players for the variable value, which is:

{
  "players": [
    "John",
    "Jane",
    "Alex",
    "Max"
  ]
}

first

Returns the first item in a list. The list must be a slice or array of basic types such as strings, numbers, or booleans.

For example:

{{ players|first }}

Will return:

John

join

Returns a stringified list with items seperated by the param. The list must be a slice or array of basic types such as strings, numbers, or booleans.

For example:

{{ players|join:", " }}

Will return:

John, Jane, Alex, Max

last

Returns the last item in a list. The list must be a slice or array of basic types such as strings, numbers, or booleans.

For example:

{{ players|last }}

Will return:

Max

length

Returns the length of the list.

For example:

{{ players|length }}

Will return:

4

length_is

Returns True if the value's length is the argument, or False otherwise.

For example:

{{ players|length_is:"4" }}

Will return:

True

random

Returns a random item from the given list. The list must be a slice or array of basic types such as strings, numbers, or booleans.

For example:

{{ players|random }}

Could return:

Alex
Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the repository. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Thank you for your contributions!