Is there a #continue
command for jump to next iteration in foreach
loop?
Velocity can be used to generate web pages, SQL, PostScript and other output from templates. It can be used either as a standalone utility for generating source code and reports, or as an integrated component of other systems.
Developer file used by Velocity, a Java-based template engine; written using the Velocity Template Language (VTL); contains VTL statements inserted in a normal text document; often used for auto-generating Web source code and class skeletons.
You would typically do something like #set ($oldIndex = $number. toNumber($oldIndex)) if you have the NumberTool present in your context, for instance. And that's it, $oldIndex contains an integer! Please note that the Integer.
I have a bunch of velocity code but I don't think I've ever seen this. I believe you have to use a #foreach
and then use and #if
to check your skip condition within the loop. The VTL guide doesn't seem have a better approach.
Based on the documentation, Apache Velocity does not appear to have a #continue function for its foreach loop.
In case it might help, it does have a foreach break directive, added in 2008.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With