godotengine / godotengine/godot-docs

Give a hint on how to remove array's element while iterating over it

Open Beginner friendly
#12,305 5 comments 0 reactions 0 assignees View on GitHub
area:class reference discussion enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
Godot 4.6

**Issue description:**
Class: Array

I was searching how to iterate through an array to remove/erase some of its elements. When I first read the docs, I understood that erasing while iterating on an array is not possible at all. The first comment of this [reddit post](https://www.reddit.com/r/godot/comments/z7b2kb/i_always_forgot_how_a_for_loop_manipulating_an/) advises to loop backward and to use `remove_at`. I think it would be nice to indicate in the docs that is possible to remove element this way, eventually directly providing a code snippet.

**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/4.6/classes/class_array.html#class-array-method-erase

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the Godot 4.6 Array documentation's erase section and review the existing guidance around remove_at. Add a clear hint or code snippet showing backward iteration for removing elements, then verify that the documentation explains when this approach is appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
godot
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.