Multidimensional input to a function

9.59K viewsScripting
0

Hi.

I am trying to define a simple function using scripting:
* Inputs: a list of elements, for instance item:id[first]..item:id[last]
* Output: any function of the whole elements (sum for instance)

How should I declare the input in the script of the function?

Under Java, I would have declared as input of my method “test” an array of doubles (“input”) containing the values “item:id[first]..item:id[last]” and written:

double test( double[] input ){
int numberItems = input.length;
double result = 0;
for( int i=0 ; i<numberItems ; i++){
result = result + input[i];
}
return result;
}

Thank you.

Julien

0

Hi Julien,

I am not sure if this is true but so far I wasn’t able to use double[] as the return type of a function.

@Quantrix developers: Is this true? How can we use an array as a result of a user defined function?

Many thanks for clarification.

Dominik

You are viewing 1 out of 16 answers, click here to view all answers.