Need help for for each item / if

hi
i’m stuck with a if condition.
i have a string = {“iphone”,“samsung”,“htc”,“huawei”}
i iterate in it with this :
for each phone in string :
if string.equals(row(2),phone)
//write in excel
else
// do nothing

suppose row(2) is the phone brand
my problem is when it compares the first item, if it’s not the same, the process stops.
i need change something and i don’t know what condition i can put on it

thanks

You can use array.contains instead of iterating the array.

if (array.Contains(row(2))) {
    //...
}
2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.