0PricingLogin
Helm Academy · Lesson

Looping Over Lists and Maps with range

Generating repeated YAML from a collection.

Repeat Without Copy-Paste

When a value holds a list, you rarely want to type each entry by hand. The range action loops over a collection and renders YAML for every item.

The range Action

A loop opens with {{ range SOMETHING }} and closes with {{ end }}. The block between them renders once per element in the collection. 🔁

{{ range .Values.hosts }}
- host: {{ . }}
{{ end }}

All lessons in this course

  1. Conditional Blocks with if and else
  2. Truthiness and Operators in Conditions
  3. Looping Over Lists and Maps with range
  4. Scoping a Block with with
← Back to Helm Academy