^table.foreach[pos;value]{code}
^table.foreach[pos;value]{code}[separator]
^table.foreach[pos;value]{code}{separator}
Method foreach executes code for each of the table rows, iterating through all table rows one by one-in the given order.
pos-name of variable to return rows' positions (from 0)
value-name of variable to return rows' values
body-code to be executed for each key-value
delimiter-string or code to be implemented before every non-empty body, except the first. The delimiter code given in square brackets is processed only once, while that in the curly brackets is processed every time it is inserted.
You can force finish the loop using break operator or finish current step and go to next one using continue operator.
Example $goods[^table::create{good price
Monitor display 1000
System control unit 1500
Keyboard 15 }]
<table border="1">
^goods.foreach[pos;row]{
<tr>
<td>^eval($pos+1)</td> <td>$row.good</td> <td>$row.price</td> </tr>
}
</table>