Loïc Grenié on Fri, 05 Nov 2021 19:04:41 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: return statement from inside parfor does not work




On Fri 5 Nov 2021 at 17:48, Max Alekseyev wrote:
The following function never terminates despite executing the 'return' statement:

f() = parfor(i=0,+oo, if(i==100,print(i);return(i)) );

Calling f() does print '100', but ignores the 'return' statement. What's wrong?

     The return() is executed in the thread, not in the main statement.
f() = parfor(i=0,+oo, if(i==100,print(i);oo),r,if(r==oo,return()) );

   should work (not tested).

     Regards,

         Loïc