For loop (basic) Last updated: 16. May 2024
This example shows basic binding binding of data to HTML. This way you can generate HTML pages from your Docly documents.
Example
Code Test.hash
<h1>Testing a loop</h1>
<ul>
#{
let items = ["a", "b", "c", "d", "e", "f", "g"];
for(let item of items)
{
if (item == "a") continue; // Skips this item and continues to next
if (item == "f") break; // Breaks and exits for loop
}#
<li>#item#</li>
#}#
</ul>
Output
<h1>Testing a loop</h1>
<ul>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
</ul>