# Reverse Find in Array

**URL:** <https://forums.unrealengine.com/t/reverse-find-in-array/375831>\
**Category:** Editor Scripting\
**Tags:** arrays, unreal-engine, find, UE4, question, Blueprint\
**Created:** [November 9, 2016, 10:00am UTC](https://forums.unrealengine.com/t/reverse-find-in-array/375831 "2016-11-09T10:00:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_c65c439d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c65c439d](https://forums.unrealengine.com/u/anonymous_user_c65c439d)\
**Post date:** [November 9, 2016, 10:00am UTC](https://forums.unrealengine.com/t/reverse-find-in-array/375831/1 "2016-11-09T10:00:38Z")

</div>

Hi, i am currently attempting to make a crude RTS, and i have a build queue for units. however i want to be able remove an item from the queue without removing index 0, as this will reset build timers. instead i want to remove from tha back of an array. (the first item of a certain name). and i cant figure out a way of doing this.

there is a built in FIND function for arrays but it goes from 0 \> N i need one that will go the other way. so i can find the index of a specific item and remove it from the back, rather than the front.

---

<div class="post-metadata">

**Author:** ![NoobsDeSroobs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NoobsDeSroobs](https://forums.unrealengine.com/u/NoobsDeSroobs)\
**Post date:** [November 9, 2016, 10:06am UTC](https://forums.unrealengine.com/t/reverse-find-in-array/375831/2 "2016-11-09T10:06:40Z")

</div>

Just iterate normally by using a for loop and simply set the index to ArraySize - index - 1; Then you can check the value yourself and break if it is the correct one.

HTH

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_210522a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_210522a1](https://forums.unrealengine.com/u/anonymous_user_210522a1)\
**Post date:** [November 9, 2016, 11:42am UTC](https://forums.unrealengine.com/t/reverse-find-in-array/375831/3 "2016-11-09T11:42:29Z")

</div>

Use a for loop, First index is array.num() last index is 0 i–. Than check it array[i] == whatever you are looking for. If that is true, i = -1 and remove thar index.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c65c439d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c65c439d](https://forums.unrealengine.com/u/anonymous_user_c65c439d)\
**Post date:** [November 9, 2016, 1:39pm UTC](https://forums.unrealengine.com/t/reverse-find-in-array/375831/4 "2016-11-09T13:39:32Z")

</div>

i managed to find a workaround with this BP function my own little loop 🙂 :

 ![114348-reversearrayfind.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/1/8/f187b8dbbfe3bdbd5970c3eff8c3dcad028f32de.png)
