How do I loop through an array while in a condition?

Hi,

I have an array called “ArrPhoneType” it contains {“Phone1”,“Phone2”,“Phone3”}

I need to somehow loop through the array in an if condition. How would i do that?
Example:See below. I need the condition loop through the array until it matches the string variable.
if (String Phonetype = ArrPhoneType)
Then Else

you can use for each activities
set for each item in ArrPhoneType
and then pull if activities inside

Hi mate, thank you for taking a look at this. Is there any way of doing without a for each loop? I’m already in a loop for something else and didn’t want to keep using a for loop. But if it’s the only option then I’ll do that

Hi,

You can also use While Activity or Do-While Activity. They need index variable(Int32) to get each element of the array.

Regards,

@rohangroombridge

You can use contains method also. For this no need of any extra loop.

if (ArrPhoneType.Contains(“searchValue”) {
//…
}

2 Likes

@rohangroombridge

image

Thank you mate. This worked perfectly

1 Like

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