# How can I use an Array + Enum for Identification purposes?

**URL:** <https://forums.unrealengine.com/t/how-can-i-use-an-array-enum-for-identification-purposes/284651>\
**Category:** Editor Scripting\
**Tags:** arrays, tarray, unreal-engine, CPP, question\
**Created:** [May 31, 2014, 12:05pm UTC](https://forums.unrealengine.com/t/how-can-i-use-an-array-enum-for-identification-purposes/284651 "2014-05-31T12:05:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [May 31, 2014, 7:39pm UTC](https://forums.unrealengine.com/t/how-can-i-use-an-array-enum-for-identification-purposes/284651/2 "2014-05-31T19:39:05Z")

</div>

#Enum Question

“How could I get access to these, so that I could do the following:”

instead of

```
void AFPSCharacter::ApplyPowerUp(int32 amnt, int32 PUid)
{
    if (PUid == Health)
    {

```

do this!

```
  void AFPSCharacter::ApplyPowerUp(int32 amnt, const EPowerups::Type PowerUpType)
    {
        if (PowerUpType == EPowerups::Health)
        {

```

#Array Question

If you want to search through an array and find ID matches, you can do this:

```
//the ID to check for
int32 TheIDToCheckFor = 9000; //something;

for(const FCollectableID& EachCollectable : PUidentification)
{
  if(EachCollectable.ID == TheIDToCheckFor )
  {
     //found a match!
     //do stuff
     break; //if only wanting 1 match, ends loop early 
   }
}

```

#NEVER USE TYPE INT

in your struct:

```
int ID;

```

should become

```
int32 ID;

```

If you have more array questions please post a separate thread about it

also

check out my wiki tutorial

#Dynamic Array Wiki Tutorial

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

Rama

---

_[View the full topic](https://forums.unrealengine.com/t/how-can-i-use-an-array-enum-for-identification-purposes/284651)._
