# ForEach Syntax

**URL:** <https://forums.unrealengine.com/t/foreach-syntax/821121>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 25, 2023, 1:07pm UTC](https://forums.unrealengine.com/t/foreach-syntax/821121 "2023-03-25T13:07:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BoXBoonNoob](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BoXBoonNoob](https://forums.unrealengine.com/u/BoXBoonNoob)\
**Post date:** [March 25, 2023, 1:07pm UTC](https://forums.unrealengine.com/t/foreach-syntax/821121/1 "2023-03-25T13:07:33Z")

</div>

Hey, where do I find the syntax list? I’m trying to use a for each and it does not work I tried foreach and for each here’s my code:

Playspace : fort\_playspace = GetPlayspace()  
AllPlayers : []player = Playspace.GetPlayers()  
for each Player in AllPlayers:  
if(FortniteCharacter : fort\_character = Player.GetFortCharacter[])  
FortniteCharacter.damage(50.0)

---

<div class="post-metadata">

**Author:** ![MattRix](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mattrix/32/686548_2.png) [@MattRix](https://forums.unrealengine.com/u/MattRix)\
**Post date:** [March 25, 2023, 10:55pm UTC](https://forums.unrealengine.com/t/foreach-syntax/821121/2 "2023-03-25T22:55:47Z")

</div>

Best place to start is the official [Verse Language Quick Reference](https://dev.epicgames.com/documentation/en-us/uefn/verse-language-quick-reference)

---

<div class="post-metadata">

**Author:** ![BeKoLLC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BeKoLLC](https://forums.unrealengine.com/u/BeKoLLC)\
**Post date:** [March 27, 2023, 4:06pm UTC](https://forums.unrealengine.com/t/foreach-syntax/821121/3 "2023-03-27T16:06:21Z")

</div>

An example with the code you provided would be

```auto
Playspace : fort_playspace = GetPlayspace()
        AllPlayers : []player = Playspace.GetPlayers()
        for (Player : AllPlayers):
            if(FortniteCharacter : fort_character = Player.GetFortCharacter[]):
                FortniteCharacter.Damage(50.0)

```
