“While” and “repeat” loops in Twig
问题 Are there any nice ways to use while and repeat loops in Twig? It is such a simple task, but without macros I can't find anything nice and simple. At least do an infinite cycle and then break it in a condition? EDIT: I mean something like do { // loop code } while (condition) or while (condition) { // loop code } Edit 2: Looks like it is not supported natively by twig same reason as it is not supported neither continue; or break; statements. https://github.com/twigphp/Twig/issues/654 回答1: In