Files
smarty/docs/designers/language-builtin-functions/language-function-while.md
Simon Wisselink 1da30e76e8 Documented support for is in, added support for is not in. (#955)
* Documented support for `is in`, added support for `is not in`.
Fixes #937
* minor docs improvement
2024-03-25 13:54:02 +01:00

709 B

{while}

{while} loops in Smarty have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All operators are recognized, such as ==, ||, or, &&, and, etc and you can use modifiers as functions, such as is_array().

Examples

{while $foo > 0}
  {$foo--}
{/while}

The above example will count down the value of $foo until 1 is reached.

See also {foreach}, {for} and {section}.