[Scilab-users] Passing function argument by reference

Rafael Guerra jrafaelbguerra at hotmail.com
Tue Jul 3 13:42:49 CEST 2018


Hi Grzegorz,

You could also use same input object as output:

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

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

o = ref_test(o);

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

Not much difference in this simple example between: “o = ref_test(o)”  and  “ref_test(o)” …

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


More information about the users mailing list