function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
m bm b 

Assign by value instead of reference

Hello,

I would like to know if there is a way to make assignment by value instead of reference.

For example, if I do

acct1.myField=5;
acct2.myField = acct1.myField;
acct1.myField=10;

If I do that, acct2.myField will be 10 in the end...WHat can I do to have acct2.myField keep the 5 vale?

Thanks!
Best Answer chosen by m b
Here-n-nowHere-n-now
don't think that's the case...  object.field at the right side of the assignment doesn't evaluate to an object reference, so in this case acct.myField would retain 5 as its value.

All Answers

Here-n-nowHere-n-now
don't think that's the case...  object.field at the right side of the assignment doesn't evaluate to an object reference, so in this case acct.myField would retain 5 as its value.
This was selected as the best answer
m bm b
THanks...I overthought this one, you're right it works.