Thanks Wayne for the clarification!
Cheers
~Niko
On 21.05.2014 02:11, Rasband, Wayne (NIH/NIMH) [E] wrote:
> On May 20, 2014, at 3:57 AM, Niko Ehrenfeuchter wrote:
>
>> Dear all,
>>
>> I'm a bit puzzled by the behaviour of the macro language "return" statement, i.e. running the following code
>>
>>> function foo1(mystr){
>>> return(mystr);
>>> }
>>>
>>> function foo2(mystr){
>>> return mystr;
>>> }
>>>
>>> print(foo1("some random text"));
>>> print(foo2("some random text"));
>>
>> results in this output:
>>
>>> 0
>>> some random text
>>
>> Is this intended? I couldn't find any hint about this in the official macro language documentation [1].
>
> The return statement in the macro language looks like this:
>
> return expression;
>
> The expression is optional and is assumed to be numeric if it starts with "(". Expressions in assignment statements are also assumed to be numeric if they start with "(". For example
>
> s = ("abc"+"def");
> print(s);
>
> outputs 0.
>
> -wayne
>
>
>> Cheers
>> ~Niko
>>
>> [1]
http://rsbweb.nih.gov/ij/developer/macro/macros.html#functions>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
--
Niko Ehrenfeuchter
Imaging Core Facility
Kragenbau, Room G1055
Biozentrum, University of Basel
Klingelbergstrasse 50/70
CH-4056 Basel (Switzerland)
Office: +41 (61) 26 72673
Email:
[hidden email]
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html