How to use array and while activity?

I’m trying to use “array” variable and “while” activity…

I often write a code in Javascript to loop like
var ary=[1,5,10];
for (ary=0, ary.length <3 ,ary++ )
//do somthing

or in PHP
for ($ary=0, count($ary) <3 , $ary++ )
//do somthing

and I understand there id no “for” structure in Uipath but are do while or while.

How can I use array variables and while loop like above?


  1. Set “while activity”
  2. Set “variables” type “array” ary=[1,5,10]
  3. Set Open browser URL property “http//:xxxxx/?=”+ary[0]←loop here

@ryoryo If you want to loop through the entire array you can use a ‘For Each’ activity. Otherwise you can either use a ‘While’ of ‘Do While’ activity and assign a counter inside it. Then use the counter as a condition for the activity. See attached workflow for examples :slight_smile:

Loop.xaml (7.7 KB)

@ryoryo Check attached file

Main.xaml (8.0 KB)

Hi, evangemert
Really thanks for your samples.It works!
but finally would you please how can i use type “System.string” or “System.int32” as,
i cant find it with “Browse for below” in drop down list.


Hi, Indra
Thanks for your comment.
I found it better to use “foreach” structure in Uipath.
and also thanks for your code shown, it works as well!

1 Like

Hi @ryoryo, that stands for an array of string or an array of integers. In the browse list you should select ‘Array of [T]’, after which you are asked to the select the variable type for inside the array. There you can select int32, string, or any other type you want.