"Numeric return value expected" when assigning array to a user-defined function that returns a string
Posted by sokipdx on
URL: http://imagej.273.s1.nabble.com/Numeric-return-value-expected-when-assigning-array-to-a-user-defined-function-that-returns-a-string-tp5017447.html
I am trying to assign an element of an array to a user-defined function that returns a string, but I get an error when I run this code:
str_list = newArray(1); // strings
num_list = newArray(1); // numbers
str_list[0] = str_fx("TEST");
num_list[0] = num_fx(9);
function str_fx (string) {
return string+"fx";
}
function num_fx (num) {
return num*num;
}
I get the error:
Numeric return value expected in the following line:
str_list[0] = str_fx("TEST" <)>;
Oddly, the num_fx function that returns a number works when assigning to an array element.