Skip to content

Instantly share code, notes, and snippets.

@johnschimmel
Created May 1, 2012 12:04
Show Gist options
  • Save johnschimmel/2567587 to your computer and use it in GitHub Desktop.
Save johnschimmel/2567587 to your computer and use it in GitHub Desktop.
Nested for loop example
<!-- Loop through each state, 's' is the incrementer value -->
<% for(s=0;s< states.length; s++) %>
<h4><%=states[s].toUpperCase()%></h4>
<UL>
<!-- Loop through allLegs for the current state, state[s] -->
<% for(i=0; i<allLegs[states[s]].length; i++) {%>
<li><%= allLegs[states[s]][i].title %></li>
<% } %> <!-- end of allLegs inner loop -->
</UL>
<% } %> <!-- end of state loop -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment