please look at the comments in code and see if you can help me with this I am checking to see if a value from $arr1 is in $arr2. If it is, add it to a list, if it is not, add it to another list. Make sure both list/arrays do not have duplicates.
$arr1 = @(1,2,3,4,4,2,5,7,9,9,1)
$arr2= @(5,1,2,3,6,8,1)
$NotinList = @()
$inList = @()
$counter = 0
for ($i = 0; $i -lt $arr1.length; $i++){
for( $j = 0; $j -lt $arr2.length; $j++ ){
if($arr1[$i] -ne $arr2[$j]){ #check to see if value from $arr1 is in $arr2
for($k = 0; $k -lt $NotinList.length; $k++){ #Traverse through empty array
write-host $arr1[$i]
if($NotinList[$k] -ne $arr1[$i]){ # *^ if empty array does not alreadycontain item from big $arr1, add it.
$NotinList += $arr1[$i]
}
}
}
else{
$inList += $arr1[$i]
#how would I remove duplicates from number in list since there are repeating numbers in $arr1 that are not in $arr2.
}
}
$counter++ #keep track may use for something else??
}