Set By-Ref Var

When you pass a variable to a function, for example, you actually pass a copy of that data. But you can pass by reference, too:

252600-capture.png

Note the shape of the pin.

It allows you to work with the data directly, rather than its copy:

Let’s say you pass 10 different variables and you want to change their value. Rather than setting them 1 by 1, using 10 Set nodes, you can have them set like this.

2 Likes

What it does?

I never know about that!
But how is possible to change 10 variables with a function?

You are amazing,
Thank you senpai!

But how is possible to change 10
variables with a function?

You’d have to pass in 10 variables and set each by ref or an array:

252615-1.png

Or like this:

Eventually you’ll run into a situation where passing by reference rather than by value makes life easier.

Having something that updates any piece of data you plug in can be handy:


252617-3.png


Structs take advantage of this, too:

252619-5.png