# Can you not modify function parameters like this in verse?

**URL:** <https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 15, 2024, 5:22pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317 "2024-03-15T17:22:50Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![SpitLotsOfFyre](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SpitLotsOfFyre](https://forums.unrealengine.com/u/SpitLotsOfFyre)\
**Post date:** [March 15, 2024, 5:22pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/1 "2024-03-15T17:22:50Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/3/8/8387d4d68eee92f929a7ec3f75af2906b3dc6c10.png)

---

<div class="post-metadata">

**Author:** ![SpitLotsOfFyre](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SpitLotsOfFyre](https://forums.unrealengine.com/u/SpitLotsOfFyre)\
**Post date:** [March 15, 2024, 5:23pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/2 "2024-03-15T17:23:42Z")

</div>

Follow-up question. Is verse pass by value or pass by reference?

---

<div class="post-metadata">

**Author:** ![DustinREDGames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dustinredgames/32/634988_2.png) [@DustinREDGames](https://forums.unrealengine.com/u/DustinREDGames)\
**Post date:** [March 15, 2024, 5:23pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/3 "2024-03-15T17:23:50Z")

</div>

It needs a return type of `int` not `void`

---

<div class="post-metadata">

**Author:** ![SpitLotsOfFyre](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SpitLotsOfFyre](https://forums.unrealengine.com/u/SpitLotsOfFyre)\
**Post date:** [March 15, 2024, 5:24pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/4 "2024-03-15T17:24:26Z")

</div>

Pretend it’s void that was just a dumb mistake

---

<div class="post-metadata">

**Author:** ![SpitLotsOfFyre](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SpitLotsOfFyre](https://forums.unrealengine.com/u/SpitLotsOfFyre)\
**Post date:** [March 15, 2024, 6:23pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/5 "2024-03-15T18:23:48Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/3/a435e061d6ad08a847b41edc717838b9394657f3.png)  
The void wasn’t the issue though  
It gives the error " The assignment’s left hand expression type `int` cannot be assigned to(3509)  
A:int"

---

<div class="post-metadata">

**Author:** ![DustinREDGames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dustinredgames/32/634988_2.png) [@DustinREDGames](https://forums.unrealengine.com/u/DustinREDGames)\
**Post date:** [March 15, 2024, 6:42pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/6 "2024-03-15T18:42:21Z")

</div>

Yeah, never ran into this before, but looks like its a reference and can’t be modified. But this works:

```auto
TestFunction(SomeValue:int):int=
{
    var changedValue:int = SomeValue + 5
    return changedValue
}

```

---

<div class="post-metadata">

**Author:** ![SpitLotsOfFyre](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SpitLotsOfFyre](https://forums.unrealengine.com/u/SpitLotsOfFyre)\
**Post date:** [March 15, 2024, 8:31pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/7 "2024-03-15T20:31:21Z")

</div>

Ok cool, I thought that that’s what I would have to do but wanted to see if there was an alternative. Thanks!

---

<div class="post-metadata">

**Author:** ![SGSensei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SGSensei](https://forums.unrealengine.com/u/SGSensei)\
**Post date:** [March 15, 2024, 9:11pm UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/8 "2024-03-15T21:11:55Z")

</div>

It looks like you are attempting to modify the parameter that is passed in to the function itself, by using a style similar to what other languages would have if you could pass params via reference. A reference is simply an address that points to a different variable. So in languages that support stuff like this, you can modify the original parameter that is passed in directly.

I do not believe Verse supports this, and instead uses pass by copy. Therefore you just need to manipulate the parameter however you want using another temporary variable to store the result, and then return that temporary variable.

---

<div class="post-metadata">

**Author:** ![ManualPotato](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/manualpotato/32/1144902_2.png) [@ManualPotato](https://forums.unrealengine.com/u/ManualPotato)\
**Post date:** [March 16, 2024, 9:49am UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/9 "2024-03-16T09:49:50Z")

</div>

An additional note - It seems as though this might be a feature planned for the future:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/a/1/3a1a818d88ddc2b882e3a3db3c8f06889a30fc73.png)

---

<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:** [April 15, 2024, 9:50am UTC](https://forums.unrealengine.com/t/can-you-not-modify-function-parameters-like-this-in-verse/1754317/10 "2024-04-15T09:50:07Z")

</div>

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