Warning | ||
---|---|---|
| ||
Much of the example code on this page needs to be rewritten; it uses deprecated features only found in the classic pico engine. |
When dealing with data, iteration is important. KRL supports implicit and explicit looping:
...
There is also a guard condition called "on final" that will allow you to execute a postlude statement only on the last iteration of the foreach.
When to Use a Loop
Warning | ||
---|---|---|
| ||
Much of the example code in this section needs to be rewritten; it uses deprecated features like pick() and page:url() only found in the classic pico engine. But, the idea of using a filter instead of a loop is still valid. |
Your instincts might be to use foreach loops in places where it’s less efficient than using implicit looping. To see when you might want to use a JPex instead of a foreach statement let’s walk through an example.
...