Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

function call with multiple output

function call with multiple output

function add
input Integer a;
input Integer b;
output Integer sum;
output Integer subtract;
output Integer multiply;
algorithm
sum:= a+b;
if (a>b) then
subtract:= a-b;
else
subtract:= b-a;
multiply:= a*b;
end if;
end add;

if i want to get just the multiplication part of the result then i did

(,,mult) := add (3,4);

which works fine but when i want only subtraction part then it doesnt work
(,sub):= add (3.4);

current/sad

Re: function call with multiple output

I haven't tried it but i think you must specify three outputs,

Code:

(,sub,);=add(3,4);

you are missing the third output.

Adeel.

Re: function call with multiple output

Create a ticket at https://trac.openmodelica.org/OpenModelica/newticket and someone will fix it. The code is valid and should work.

Re: function call with multiple output

but when i call like this (add,sub):= add (3,4) ; then it works........doesnt need the third argument.

There are 0 guests and 0 other users also viewing this topic
You are here: