• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to break from <xen:foreach>

xfrocks

Well-known member
#4
There's no break, but you can iterate for a specific count like this:
Code:
<xen:foreach loop="$array" key="$key" value="$value" i="$i">
<xen:if is="{$i} <= 10">
<div>{$value}</div>
</xen:if>
</xen:foreach>
TIL <xen:foreach> supports "i"!!!! I have to fix my array_values calls now. Thanks Kier!
 

Hoffi

Well-known member
#5
You're a good software developer, if you did can program without using break. ;) (Except in switch/case!)