Skip to content

📝 Add loop.parent example#4865

Closed
homersimpsons wants to merge 1 commit into
twigphp:3.xfrom
homersimpsons:doc/loop.parent
Closed

📝 Add loop.parent example#4865
homersimpsons wants to merge 1 commit into
twigphp:3.xfrom
homersimpsons:doc/loop.parent

Conversation

@homersimpsons

@homersimpsons homersimpsons commented Jul 18, 2026

Copy link
Copy Markdown

The current wording does not give enough explanation to me. I had to find https://stackoverflow.com/questions/17534802/how-does-loop-parent-actually-work to understand its need.

I added an example with variable shadowing, should I add one with nested loops? such as:

{% for i in [1, 2, 3] %}
  {% for j in [1, 2, 3] %}
    {{ loop.parent.loop.index }} - {{ loop.index }}
  {% endfor %}
{% endfor %}

@homersimpsons homersimpsons changed the title 📝 Add loop.parent explanations 📝 Add loop.parent example Jul 18, 2026
@homersimpsons

Copy link
Copy Markdown
Author

(this can be a duplicate of #4862)

@fabpot

fabpot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Closing in favor of #4862

@fabpot fabpot closed this Jul 19, 2026
@homersimpsons homersimpsons mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants