For loops
Rwf templates have only one kind of for loop: for each. This allows writing more reliable templates, and to avoid common bugs like infinite loops, which will stall a web app in production.
A for loop can iterate over a list of values, for example:
Template lists, unlike Rust's Vec
, can hold variables of different data types, and are dynamically evaluated at runtime:
Do n times
If you need to execute some code multiple times, templates come with a handy times
function: