Re: Passing arrays to functions without declaring an array variable first
Posted by
Herbie on
Nov 23, 2019; 6:18pm
URL: http://imagej.273.s1.nabble.com/Passing-arrays-to-functions-without-declaring-an-array-variable-first-tp5022700p5022701.html
Good day Stein,
in your second example there is no name of the array but there need to be
one because the array is "in a certain sense returned" after the execution
of the function. In your second example there is no variable for the
"returned" array.
HTH
Herbie
::::::::::::::::::::::::::::::::::::::::::
Assuming a macro function accepting an array as a parameter:
function printArray(a) {
print("");
for (i=0; i<a.length; i++)
print(i+": "+a[i]);
}
What is the reason this works:
arr = newArray("cat", "dog", "mouse",
"rabbit");
printArray(arr);
But not this:
printArray(newArray("cat", "dog", "mouse",
"rabbit"));
?
Stein
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html</quote>
--
Sent from:
http://imagej.1557.x6.nabble.com/--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html