ossiejhmoore icon

Untitled

ossiejhmoore | PRO | 05/22/23 10:15:18 PM UTC | 0 ⭐ | 219 👁️ | Never ⏰ | []
text |

610 B

|

None

|

0 👍

/

0 👎

  List        foo = {1,2,9,10,11,12,8}
List        bar = {3,4,5,6,7,8}
  echo( IsAnyOverlap(foo,bar) )
   function Boolean IsAnyOverlap( List a, List b )
	Boolean found = FALSE
	List    inner
	List    outter
	Dynamic item
  	if ( ( IsDefined( a ) ) || ( IsDefined( b ) ) )
 		//it doesn't matter which is outter, so make smaller one of the two outter
 		if ( Length( a ) < Length( b ) )
 			outter = a
			inner = b
 		else
 			outter = b
			inner = a
 		end
 		for item in outter
 			found = item in inner
 			if ( found )
 				break
 			end
 		end
 	end
 	return found
 end
 

Comments