Title here
Summary here
Here’s a function that will take an arbitrary number of Int
as arguments.
Within the function, the type of nums
is equivalent to Real[:]
. We can call size(nums, 1)
, iterate over it with a for
loop, etc.
If you already have multiple arguments in an array, apply them to a variadic function using the array directly.
To run the program, load it in a Modelica environment such as OpenModelica or Dymola and simulate the VariadicFunctions
model. The output will display the sum of the numbers passed to the sum
function.