Function rocket_dyn_templates::minijinja::functions::range

source ·
pub fn range(
    lower: u32,
    upper: Option<u32>,
    step: Option<u32>
) -> Result<Vec<u32>, Error>
Expand description

Returns a range.

Return a list containing an arithmetic progression of integers. range(i, j) returns [i, i+1, i+2, ..., j-1]. lower defaults to 0. When step is given, it specifies the increment (or decrement). For example, range(4) and range(0, 4, 1) return [0, 1, 2, 3]. The end point is omitted.

<ul>
{% for num in range(1, 11) %}
  <li>{{ num }}
{% endfor %}
</ul>

This function will refuse to create ranges over 10.000 items.