While - break in Hugo

Good afternoon. PHP has a loop
If {$ i> 2} break;
How to do this in hugo?

I think it is impossible, and it would be cool if you could raise a feature request in here:

Prefix your issue with “text/template:” so they know what it’s about. I could do it, but I think they are tired of getting issues from me :slight_smile:

So, the ugly workaround is to complete the loop, but only print the items you’re looking for.

I created the issue

I suggest you update that issue and prefix it with “text/template” and make sure that it is templates you are talking about (and not the Go language, which of course have both break and continue).

Thanks, done.

Your issue (reposted by me) just got (sort of) OKed by two of the smartest persons in Google:

If you don’t know about these two people, you should read their bio.

2 Likes