0 votes

I'm kind of new to programming and I want to know if there is a way without a for loop to discovery and use the index of an array.

Example:
var clock = [orange, yellow, abc, ..., ]

If clock index is 2:
print ("spiderman")

asked Dec 24, 2018 in Gossip by arthurZ (74 points)

I dont understand the question. An array is an object with components inside. Each component has an index asociates. You want to see what the 'current' index of an array is? Well, You will have to create and modify the index yourself. If you tell me what you want to acomplish, may be i can help you more

There's no such thing as "discovering an index of an array". No offense but it really does sound like you're a beginner at programming. Read this and this, and come back later.

1 Answer

0 votes

want to know if there is a way without a for loop to discovery and use the index of an array.

You can program your own data structure, that keeps track of the indexes for you, adding the functionality.

Instead I will recommend using Dictionaries, these have a index that you can just call when you want.
https://docs.godotengine.org/en/3.0/classes/class_dictionary.html

answered Dec 25, 2018 by MysteryGM (1,400 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.