Everynone
(Everynone)
September 3, 2018, 7:07pm
1
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:
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
DRcookie
(DRcookie)
September 3, 2018, 7:41pm
3
I never know about that!
But how is possible to change 10 variables with a function?
You are amazing,
Thank you senpai!
Everynone
(Everynone)
September 3, 2018, 9:40pm
4
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:
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:
Structs take advantage of this, too: