Mentioning a range is equivalent to foreach (#1086)

* Mentioning a range is equivelant to foreach

I’m new to Go and really struggled to find this. I added this sentence so it would be searchable for other people to find. At the moment, searching for a foreach doesn’t return range and IMHO it should.

* Fixed a spelling error for equivalent
This commit is contained in:
Dave Redfern 2020-04-16 13:55:34 +01:00 committed by GitHub
parent 0c396911f1
commit b3ffd1ad32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,6 @@ draft: false
aliases: []
---
Just like in the Go programming language, Go and Hugo templates make heavy use of `range` to iterate over a map, array or slice.
Just like in the Go programming language, Go and Hugo templates make heavy use of `range` to iterate over a map, array or slice. Other templating languages use a foreach for the equivalent functionality.
`range` is fundamental to templating in Hugo. (See the [Introduction to Hugo Templates](/templates/introduction/) for more examples.)