Twig loop index into array

{% for com in comments %}
    <p>Comment {{ nameComments[ loop.index ] }} : "{{ com['comment'] }}"</p>
{% endfor %}

Just leave out the curly brackets. This should work fine. By the way loop.index is 1 indexed. If you loop through an array which normally starts with index 0 you should consider using loop.index0

See the documentation


It is safer to iterate over the real value of the array index and not using loop.index and loop.index0 in case where array indexes do not start in 1 or 0 or do not follow a sequence, or they are not integers.

To do so, just try this:

{% for key,com in comments %}
    <p>Comment {{ nameComments[key] }} : "{{ com['comment'] }}"</p>
{% endfor %}

See the documentation