How do I apply loop into node twig template? This is code I am using. 

&lt;div class="blog-main-content"&gt;
  &lt;figure&gt;{{ content.field_article_main_content[0] }}&lt;/figure&gt;
  &lt;p class="intro-pera"&gt;{{ content.field_article_main_content[1] }}&lt;/p&gt;
&lt;/div&gt;


How can I change that code to make it loop over content.field_article_main_content?
I would use code similar to the following one.

&lt;div class="blog-main-content"&gt;
  {% for key, item in content.field_article_main_content %}
    {% if key == 0 %}
      &lt;figure&gt;{{ content.field_article_main_content[key] }}&lt;/figure&gt;
    {% else %}
      &lt;p class="intro-pera"&gt;{{ content.field_article_main_content[key] }}&lt;/p&gt;
    {% endif %}
  {% endfor %}
&lt;/div&gt;


If it happens that some values of key start with #, then I would use the following code.

&lt;div class="blog-main-content"&gt;
  {% for key, item in content.field_article_main_content if key|first != '#' %}
    {% if key == 0 %}
      &lt;figure&gt;{{ content.field_article_main_content[key] }}&lt;/figure&gt;
    {% else %}
      &lt;p class="intro-pera"&gt;{{ content.field_article_main_content[key] }}&lt;/p&gt;
    {% endif %}
  {% endfor %}
&lt;/div&gt;