sum

Adds together elements of an array.

{% json ar %}
[1,2,3,4,5,6,7,8,9]
{% endjson %}

{% assign sum_of_elements = ar | sum %}
{{ sum_of_elements | log }}

As a result sum_of_elements variable contains following value: 45

Last updated