Hi. Sorry for My English in Advance.
Straight to the question.
I have an Array of Names which I want to Show on the screen.
For example, I have 5 array Elements and “For Each loop” perfrorm its’s work perfect. I get 5 different names Displayed on the screen. But The Question is…
How to make The loop ignore specific index? without breaking the loop?
If I have an Array with 5 Elements:
Name_0
Name_1
Name_2
Name_3
Name_4
How to show to the code that He must skip specific index, do not add it and keep adding the others
For Example I want to set up ignore indexes # 0 and #3. As he output I want to get displyaed on the screen:
Name_1
Name_2
Name_4
Name_5
And Make the system as dynamic as possible.
I hope u understtod my question. Thank you.
First of all thank you, that actually works, yes, but it kind of not flexible. What Should I do if I would have 17 array elements and I need only get displayes 2, 3, 7 and 9 elements, this is extremelny inconvenient. I know you would suggest Array Get (index). But is there any method to add kind of another array like “make array” and set up indexes to ignore?
Without knowing what determines which indexes you want to get, it’s hard to know the “best” way to make the solution “flexible”. What causes the difference in which indexes you want to ignore? It would be best to simply look for the condition that causes you to want to ignore them as you iterate through them.
This is quite an old thread, but it’s the closest thing I could find to what I’m trying to figure out, too.
To add on to the “flexibility” of this code, I have a scenario where I have an array list of 7 weapons total. If I have not picked up a weapon yet in the game, then it should not be available to select and use yet. Therefore, that specific index should be skipped over.
To be more specific to my case, here is my weapon setup. It is based off of a tutorial from Ryan Laley on YouTube:
Say I am at the beginning of the game and only have picked up the “Painkiller” and the “Shotgun”, how could I set it up so that it knows the rest of the weapons have not been picked up yet and will skip over those indexes? And then how to make it so that once I pickup a new weapon, say the “Stakegun”, that index then becomes available and it won’t be skipped?