Hi,
I need to break the foreach loop when the condition fails.
Is there an alternative for#break in velocity script
Ex code
#set($a=[1,2,3,4,5,6,7,8,9]) #foreach($item in $a) #if($item==5) #break #end $a #end
Hi,
I need to break the foreach loop when the condition fails.
Is there an alternative for#break in velocity script
Ex code
#set($a=[1,2,3,4,5,6,7,8,9]) #foreach($item in $a) #if($item==5) #break #end $a #end
There is not, you would need to pre-filter the list in question or use a flag or embedded logic to bypass anything you wish not to execute. So an example would be to reverse your logic that you are showing (if(item != 5) and put want you want to render inside the IF