Index based loop


I’m trying to get a list of deployed packages into an email at the end of a deployment.

Is there a way of looping through an index based collection, something like this:

#{for i = 0; i < = #{Octopus.Steps.Count}; i++ }

I haven’t been able to find the correct syntax …


Hi Ken,

Thanks for getting in touch. Perhaps the #{each} syntax will suit your situation?

Take a look at the example provided in

<p>The deployment included the following actions:</p>
  #{each action in Octopus.Action}
    <li><strong>#{action.Name}</strong> #{if action.Package.NuGetPackageId}&mdash; <a href="{action.Package.NuGetPackageId}">#{action.Package.NuGetPackageId}</a> <em>version #{action.Package.NuGetPackageVersion}#{/if}</em></li>

If I’ve missed the point of your question, please let me know more specifically what you’re trying to achieve and I’ll be happy to help you further.

Hope that helps!

Hi Michael

Yep that seems to work –thanks!

I based my enquiry on a 2013 post by Paul Stovell that seemed to suggest that doing this needed indexes, but I guess that might be a bit obsolete :slight_smile:

Great product by the way. I’m trialling Octopus after months of frustration using Release Management, and am very pleased with it.


Ken Arthur
Senior Software Engineer
Direct: +61 7 3177 4754



Hi Ken,

Thanks for getting back to us. I’m glad that worked our for you!