# Replace a specific element in an array?

**URL:** <https://forums.unrealengine.com/t/replace-a-specific-element-in-an-array/1260629>\
**Category:** Programming & Scripting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [August 14, 2023, 1:26pm UTC](https://forums.unrealengine.com/t/replace-a-specific-element-in-an-array/1260629 "2023-08-14T13:26:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![N0baa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@N0baa](https://forums.unrealengine.com/u/N0baa)\
**Post date:** [August 14, 2023, 1:26pm UTC](https://forums.unrealengine.com/t/replace-a-specific-element-in-an-array/1260629/1 "2023-08-14T13:26:35Z")

</div>

I have an array of text blocks for a UI element (6 in total), and other devices can edit the text in any of these text blocks by accessing it through the array through a method that takes in an index and the value to change. I know arrays are immutable and you can add an element to the end of an array, but is there a way to edit the specific element that is required by the method’s arguments?

---

<div class="post-metadata">

**Author:** ![N0baa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@N0baa](https://forums.unrealengine.com/u/N0baa)\
**Post date:** [August 14, 2023, 2:54pm UTC](https://forums.unrealengine.com/t/replace-a-specific-element-in-an-array/1260629/2 "2023-08-14T14:54:50Z")

</div>

Solved, was pretty simple in the end:

```auto
if(set array[index] = newelement){}

```

the curly brackets at the end are necessary

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 13, 2023, 2:55pm UTC](https://forums.unrealengine.com/t/replace-a-specific-element-in-an-array/1260629/3 "2023-09-13T14:55:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
