# How to pass a function (not a result) as a member of an array

**URL:** <https://forums.unrealengine.com/t/how-to-pass-a-function-not-a-result-as-a-member-of-an-array/2257566>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [January 3, 2025, 1:19pm UTC](https://forums.unrealengine.com/t/how-to-pass-a-function-not-a-result-as-a-member-of-an-array/2257566 "2025-01-03T13:19:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![michll](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@michll](https://forums.unrealengine.com/u/michll)\
**Post date:** [January 3, 2025, 1:19pm UTC](https://forums.unrealengine.com/t/how-to-pass-a-function-not-a-result-as-a-member-of-an-array/2257566/1 "2025-01-03T13:19:41Z")

</div>

```auto
DebugFunc():void=
        var TestArr : []void = array{}
        set TestArr += array{DebugFunc2}
        for (FuncToProcess : TestArr):
            FuncToProcess
DebugFunc2():void=
        Print("2")

```

So this compiles but crashes the UEFN session. If I add “()” in “array{DebugFunc2}” then it won’t crash, but I will get “Print(“2”)” immediately, but I want to delay the result until the for loop starts going through. I don’t know if it’s even possible, so any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [January 4, 2025, 10:58am UTC](https://forums.unrealengine.com/t/how-to-pass-a-function-not-a-result-as-a-member-of-an-array/2257566/2 "2025-01-04T10:58:06Z")

</div>

```auto
DebugFunc():void=
    # var TestArr : []void = array{}
    var TestArr : [](tuple() -> void) = array{}
    set TestArr += array{DebugFunc2}
    for (FuncToProcess : TestArr):
        # FuncToProcess
        FuncToProcess()
DebugFunc2():void=
    Print("2")

```

---

<div class="post-metadata">

**Author:** ![michll](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@michll](https://forums.unrealengine.com/u/michll)\
**Post date:** [January 5, 2025, 6:31pm UTC](https://forums.unrealengine.com/t/how-to-pass-a-function-not-a-result-as-a-member-of-an-array/2257566/3 "2025-01-05T18:31:21Z")

</div>

thanks youre the goat bro

---

<div class="post-metadata">

**Author:** ![Jeremy\_Choud](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jeremy_choud/32/907645_2.png) [@Jeremy\_Choud](https://forums.unrealengine.com/u/Jeremy_Choud)\
**Post date:** [January 19, 2025, 2:44am UTC](https://forums.unrealengine.com/t/how-to-pass-a-function-not-a-result-as-a-member-of-an-array/2257566/4 "2025-01-19T02:44:59Z")

</div>

To add onto what LAMA posted if you need to specify a method that has an effect you can use this syntax

i personally like to replace the ‘\_’ with ‘func’

so

```auto
type{func(:param1, :param2)<effect_here>:void}

```

```auto
DebugFunc():void=
    var TestArr : []type{_()<transacts><decides>:void} = array{}
    set TestArr = TestArr + array{DebugFunc2}
    for(Func:TestArr):
        if(Func[]):

DebugFunc2()<transacts><decides>:void={1 = 1}

```

---

<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:** [February 18, 2025, 2:45am UTC](https://forums.unrealengine.com/t/how-to-pass-a-function-not-a-result-as-a-member-of-an-array/2257566/5 "2025-02-18T02:45:07Z")

</div>

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