If statement - Comparing one items in a list for each items in a for loop


Good day

Is the a way use a if statement in a for loop to compare each item in a list

and not one item at a time

I have 2 lists, and want to perform different functions for each items in the list when they are equal


I think if you use two For Loops one after the other, you should be able to achieve what you’re trying to do.


Yeah like @LJ-DJ said. Basically a simple sort function.


for (int i=0; i<length; i++)
for(int j=0;j<length;j++)
{ //do something}


I am trying the two for loops but the condition is where the issue is…can’t break out of the for loop…


Um, you need to have a break statement.

Debug your code


got it sorted thanks


Post your solution for other people when they search for this.


Please let me know the solution as I am also stuck on this.

Thanks !


What are you stuck on? Comparing of the two tables? perhaps post the piece here that you are stuck with?



I have posted my query on For loop with if statements
this post.
Can you please check that.