How do I apply something to a node array that excludes one item?

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

I have a random number generator that generates a number used for calling show() on a node (e.g. items[number].show()). Is there a way to do something similar to items[ "not in" number].hide()?

:bust_in_silhouette: Reply From: godot_dev_

You could iterate over each item in the list, keeping track of the index i. When i == number, then you call items[ix].show(), otherwise you call items[ix].hide(). Would this solve your problem?