How to use for Loops in twig file Drupal 8?

For Example: A for function. The output for this is 0, 1, 2, 3, 4, 5, 6.
 The range function returns a list containing an arithmetic progression of integers.

{% for i in range(0, 6) %}
  {{ i }},
{% endfor %}

Example:
{% for item in items %}
  {{ item.content }}
{% endfor %}

Inside of a for loop block you can access some special variables.
items.index The current iteration of the loop. (1 indexed)
items.index0  The current iteration of the loop. (0 indexed)
items.revindex  The number of iterations from the end of the loop (1 indexed)
items.revindex0 The number of iterations from the end of the loop (0 indexed)
items.first True if first iteration
items.last  True if last iteration
items.length  The number of items in the sequence
items.parent  The parent context

Tags