HUGO
Menu
GitHub 87548 stars Mastodon

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>

有关更多信息,请参阅 Go 的 text/template 文档。


Last updated: January 1, 0001
Improve this page