MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why Return[] does not work?

Dims wrote:
> On 27 =D0=B0=D0=BF=D1=80, 16:28, Albert Retey <a... at> wrote:
>> Am 27.04.2010 13:41, schrieb Dims:
>> Intersects[x_List, y_List] := Catch[
> Yes, thank you, I also came to conclusion, that catch works. But I
> think it is a bug with return, since manual says, that we CAN use
> Return[] inside Do[].
Yes, but it will exit one Do construct, and you have two!

Everyone needs to use explicit loops sometimes (or at least I do!) but I 
find While loops are more convenient:

do something;

One reason is that yo can set a boolean, and add it to the test on the 
While - thus exiting as many loops as needed.

I take it you realise that there is a built in function Intersect, and 
that this was a programming exercise.

David Bailey

  • Prev by Date: Odd phenomenon
  • Next by Date: Re: NDSolve: ..numerically ill-conditioned...
  • Previous by thread: Re: Why Return[] does not work?
  • Next by thread: Re: Why Return[] does not work?