[Scilab-users] Passing function argument by reference

Rafael Guerra jrafaelbguerra at hotmail.com
Mon Jul 2 19:52:20 CEST 2018


Hi,

This seems to be a question of global and local scope of variables.
You can try:

function o2=ref_test(obj)
    o2 = obj;
    o2.a = 10;
endfunction

o = tlist(["tlisttype", "a", "b"], 0, 0);

o2 = ref_test(o);

if o2.a == 10 then
    disp("It works");
else
    disp("It does not work");
end

Regards,
Rafael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180702/5709d3cf/attachment.htm>


More information about the users mailing list