That looks like eRb or Ruby on Rails or something but couldn’t you just
do:
<% @photos.each_with_index do |photo, i| %>
<% if (i % 4).zero? %>
<% end %>
<%end%>
To get each_with_index you must require ‘enumerator’ but you could do
Array#each_index and then instead of photo.id you have photos[i].id. Of
course, this all assumes that photos is an array.