Why Return[] does not work?

*To*: mathgroup at smc.vnet.net*Subject*: [mg109448] Why Return[] does not work?*From*: Dims <dims12 at hotmail.com>*Date*: Tue, 27 Apr 2010 07:41:50 -0400 (EDT)

I wrote a function to check if two lists contain equal members: Intersects[x_List, y_List] := (Do[(Print["Outer step ", xi]; Do[(Print[xi, yi]; If[xi == yi, (Print["Returning True"]; Return[True])]), {yi, y}]), {xi, x}]; False) But it returns False for interecting lists: In[47]:= Intersects[{a, b}, {c, a}] During evaluation of In[47]:= Outer step a During evaluation of In[47]:= ac During evaluation of In[47]:= aa During evaluation of In[47]:= Returning True During evaluation of In[47]:= Outer step b During evaluation of In[47]:= bc During evaluation of In[47]:= ba Out[47]= False Few questions: 1) why does not Return[] interrupt the loops? 2) is there better way to implement intersection check? Thanks