# how do i put a list of items into my tarray?

**URL:** <https://forums.unrealengine.com/t/how-do-i-put-a-list-of-items-into-my-tarray/54162>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [February 1, 2016, 1:41pm UTC](https://forums.unrealengine.com/t/how-do-i-put-a-list-of-items-into-my-tarray/54162 "2016-02-01T13:41:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MajekPL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MajekPL](https://forums.unrealengine.com/u/MajekPL)\
**Post date:** [February 1, 2016, 1:41pm UTC](https://forums.unrealengine.com/t/how-do-i-put-a-list-of-items-into-my-tarray/54162/1 "2016-02-01T13:41:30Z")

</div>

hey.  
in my header its  
UPROPERTY(BlueprintReadWrite, Category = “Config”)  
TArray\<uint8\>ArrayName;

im using this in my constructor: ArrayName.Add = (8, -8, 1, -1, 7, -7, 9, -9);

but he returns an error: “=”: function as left operant.  
whats wrong?

thanks!

---

<div class="post-metadata">

**Author:** ![amcgator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@amcgator](https://forums.unrealengine.com/u/amcgator)\
**Post date:** [February 1, 2016, 4:13pm UTC](https://forums.unrealengine.com/t/how-do-i-put-a-list-of-items-into-my-tarray/54162/2 "2016-02-01T16:13:57Z")

</div>

I think you can only add one item at a time so in your case it would be

ArrayName.Add(8);  
ArrayName.Add(-8);  
ArrayName.Add(1)  
ArrayName.Add(-1)

> **[TArray: Arrays in Unreal Engine](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/TArrays/)**

🙂

---

<div class="post-metadata">

**Author:** ![ZkarmaKun](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zkarmakun/32/1194545_2.png) [@ZkarmaKun](https://forums.unrealengine.com/u/ZkarmaKun)\
**Post date:** [February 2, 2016, 1:21am UTC](https://forums.unrealengine.com/t/how-do-i-put-a-list-of-items-into-my-tarray/54162/3 "2016-02-02T01:21:37Z")

</div>

hi majekpl maybe you must see basics of programming .Add is a method inside TArray for abvious reason cant be assigned  
.Add is using like this myArray.Add(myobj) all method need some arguments if required check about object oriented programming and how to do a class from scratch  
if you want use tarray costructor you need use like this myArray.Init()

---

<div class="post-metadata">

**Author:** ![Jackblue](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jackblue/32/88706_2.png) [@Jackblue](https://forums.unrealengine.com/u/Jackblue)\
**Post date:** [February 2, 2016, 8:40am UTC](https://forums.unrealengine.com/t/how-do-i-put-a-list-of-items-into-my-tarray/54162/4 "2016-02-02T08:40:00Z")

</div>

You can read some useful things about TArray here:

> **[TArray: Arrays in Unreal Engine](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/TArrays/)**

> **[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...

If you want to populate an Array in one line, you can do this:

```auto

	TArray<uint8> ArrayName;
	uint8 SimpleArray] = {8, -8, 1, -1, 7, -7, 9, -9};
	ArrayName.Append(SimpleArray, ARRAY_COUNT(SimpleArray));

```

I hope this help you 🙂

---

<div class="post-metadata">

**Author:** ![MajekPL](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MajekPL](https://forums.unrealengine.com/u/MajekPL)\
**Post date:** [February 2, 2016, 11:08pm UTC](https://forums.unrealengine.com/t/how-do-i-put-a-list-of-items-into-my-tarray/54162/5 "2016-02-02T23:08:02Z")

</div>

thanks alot it works! 🙂
