HUGO
News Docs Themes Community GitHub

break

Used with the range statement, stops the innermost iteration and bypasses all remaining iterations.

Syntax

break

This template code:

{{ $s := slice "foo" "bar" "baz" }}
{{ range $s }}
  {{ if eq . "bar" }}
    {{ break }}
  {{ end }}
  <p>{{ . }}</p>
{{ end }}

Is rendered to:

<p>foo</p>

See Go’s text/template documentation for more information.


Last updated: January 1, 0001
Improve this page