I have two arrays
arrA: {22222,21530,11111,21994,22009,12345}
arrB: {21530, 21994, 22009}
I want to return 22222, 11111, 12345
so I use
for each a in arrA:
for each b in arrB:
if a.tostring <> b.tostring:
string abc = string.Join(“,”, abc, a)
However, I am geeting the result:
It’s not duplicate issue, it’s wrong result. How can I get only 22222, 11111, 12345?? Thanks!
I am aware of this:
but doesn’t help much.
P.S. prior to this I actually have another nested loop and if statement for validation - I tried to get all these non exist number in the ELSE portion but facing similar issue because it’s a nested loop… that’s why I created the 2nd nested loop hoping to put the numbers in the THEN statement… >.>…
The result is because every number in first array is compared with each and every number in the second array that is why it is printing like this!
Try using while loop instead. That’ll give you the correct result!
Hi! Here is a working worklow I made for you: Arrays.xaml (10.4 KB)
What I’ve done is that I’ve taken a counter variable which I am incrementing when two elements are unequal…
After the inner for loop I am checking if that counter variable is equal to the length of inner array if yes, then join that particular number!