Feature request: Array.remove() should return the item

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Armslice

I have often got stuck assuming that Array.remove() will return the item being removed. Seems to be 99% that I call remove I am planning on using the item that I am removing. If remove() returned the item rather that void it would be convenient and save a line of code. Is there a reason why this isn’t the way remove works? If it would be too inefficient then prehaps we could add a method call liked “popFrom(int position)” that would add that line of code. I know I can just write a helper function and include it in my autoLoad. I guess I’m more so curious why remove does not return the item in the first place.

Thank you, and happy godoting.


:bust_in_silhouette: Reply From: null_digital

You can post feature requests at Issues · godotengine/godot · GitHub

This seems like a good feature. I don’t know if there’s a technical reason to not have this feature.