# How to Print Array's Content Using ForEachLoop?

**URL:** <https://forums.unrealengine.com/t/how-to-print-arrays-content-using-foreachloop/373649>\
**Category:** UI\
**Tags:** string, foreachloop, unreal-engine, Array, Widget, question\
**Created:** [October 18, 2016, 8:47am UTC](https://forums.unrealengine.com/t/how-to-print-arrays-content-using-foreachloop/373649 "2016-10-18T08:47:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a0e129a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a0e129a](https://forums.unrealengine.com/u/anonymous_user_0a0e129a)\
**Post date:** [October 18, 2016, 8:47am UTC](https://forums.unrealengine.com/t/how-to-print-arrays-content-using-foreachloop/373649/1 "2016-10-18T08:47:02Z")

</div>

How can I make a String Array to print all its content to a a Widget static text? I am using ForEachLoop to scan through the Array, but it only prints the last Index in the Array as a result for my static text.

So to visualize it for you: If I have lets say: Ash, Misty, and Brock in this order in the String Array and it goes through the ForEachLoop, the result would be Brock for my “Set Players” text.

Now how can I make it so that the result would be: Ash, Misty, Brock instead of just Brock?

And just a bonus, how could I make it so that there would be (,) after each name, so they don’t pile up as: AshMistyBrock. I know using Append you can achieve this but thus far it would only help me as far as for the first name: Ash, MistyBrock.

 ![111347-string+text.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/1/721d3afaeb76a43d6976c5502d6b5a8a6a85357e.png)

---

<div class="post-metadata">

**Author:** ![learningOver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@learningOver](https://forums.unrealengine.com/u/learningOver)\
**Post date:** [October 18, 2016, 10:05am UTC](https://forums.unrealengine.com/t/how-to-print-arrays-content-using-foreachloop/373649/2 "2016-10-18T10:05:52Z")

</div>

![111381-stringappend.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/b/7/ab7e4fb7e3156939e73b9d131f4a520aed75c239.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0a0e129a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0a0e129a](https://forums.unrealengine.com/u/anonymous_user_0a0e129a)\
**Post date:** [October 19, 2016, 9:59am UTC](https://forums.unrealengine.com/t/how-to-print-arrays-content-using-foreachloop/373649/3 "2016-10-19T09:59:40Z")

</div>

Thank you so much for this great piece of code. I got mine to work differently but this seems to work fine, too. I can use it in the future 🙂
