For loop (basic) Last updated: 06. Dec 2022

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>
#{
    var items = ["a", "b", "c", "d", "e", "f", "g"];
    
    for(var 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>