Skip to content
Nat! edited this page Mar 1, 2023 · 3 revisions

while ... endwhile

Until the expression expr evaluates to NO, zero or nil the code block after the while statement until the endwhile statements keeps getting executed.

Example

{# render an old skool HTML table with while #}
<table>
   <tr><th>TimeZone</th></tr>
{% rover = [[NSTimeZone knownTimeZoneNames] objectEnumerator] %}
{% while item = [rover nextObject] %}
   <tr><td>{{ item }}</td></tr>
{% endwhile %}
</table>

Output:

<table>
   <tr><th>TimeZone</th></tr>
</table>
Clone this wiki locally