You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would suggest you use Rocker's @for command for iterating thru collections. Please consult the syntax docs for more info. There's a very handy "rocker iterator" object that can be included along with iterating that lets you get the current index, check for last/first, etc.
As far as local variable declarations, you would potentially achieve that with the @with command, but I consider creating variables in a template a practice you should try to avoid. I purposefully make it hard to declare variables in the templates since I think it creates spaghetti-like templates. You can either call out to Java methods to achieve a better (more testable) result or redesign your template arguments to accept better prepped data that doesn't need variables. For any iterations, definitely leave that to the @for command.
How do I declare a local variable
@counter
and use it in a loop
The text was updated successfully, but these errors were encountered: