... | in limited_loop.naml |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
<macro name="limited_loop" requires="sequence" dot_parameter="do" parameters="start,length,by,if_truncated">
<n.comment.>
Allows one to loop through part of a list, skipping the rest of it.
</n.comment.>
<n.set_var. name="max">
<n.int. i="[n.default. to='0'][n.start/][/n.default.]">
<n.plus i="[n.default. to='9999'][n.length/][/n.default.]"/>
</n.int.>
</n.set_var.>
<n.while>
<condition.both>
<condition1.next_element inc="[n.by/]"/>
<condition2.is_less_than value1="[n.current_index/]" value2="[n.var name='max'/]"/>
</condition.both>
<loop>
<n.if.not.is_less_than value1="[n.current_index/]" value2="[n.start/]">
<then.do/>
</n.if.not.is_less_than>
</loop>
</n.while>
<n.if.is_less_than value1="[n.current_index/]" value2="[n.element_count/]">
<then.falsy_to_empty.if_truncated/>
</n.if.is_less_than>
</macro>
|
Free forum by Nabble | Naml |