12

/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml is the template responsible for the product list in a category page for example, it loads the products collection and the print it with a classic foreach ($_productCollection as $_product).

Inside the foreach we have:

<?php $iterator = 1; ?>
<ol class="products list items product-items">
    <?php /** @var $_product \Magento\Catalog\Model\Product */ ?>
    <?php foreach ($_productCollection as $_product): ?>
        <?php /* @escapeNotVerified */ echo($iterator++ == 1) ? '<li class="item product product-item">' : '</li><li class="item product product-item">' ?>
        ...
        <?php echo($iterator == count($_productCollection)+1) ? '</li>' : '' ?>
    <?php endforeach; ?>
</ol>

why not a simpler code like this?

<ol class="products list items product-items">
    <?php /** @var $_product \Magento\Catalog\Model\Product */ ?>
    <?php foreach ($_productCollection as $_product): ?>
        <li class="item product product-item">
        ...
        </li>
    <?php endforeach; ?>
</ol>