Array & list

If we are able to add an item to an array using concat method, then could you please help me understand the difference between array and the list. As per my understanding, list is of flexible size where we can keep on adding items to them using add to collection, but array is of fixed size where we can’t add items to it. So could you please respond and help me understand this

Hi @shashank

Yes you are correct.

array is fixed in size.We cant able to add the elements rather than the Index .
When we add elements rather the specified index.It thrown an exception.Array index out of bound.
List is not fixed in size.We can add and delete the elements from it.

Hope it helps!!

Hi @shashank

Your understanding is right actually. You can read the below explanation too. I think this will help you.

Array: An array in UiPath has a fixed size, meaning you must specify how many elements it will hold when you create it. Once created, you cannot change this size. If you try to add elements beyond its predefined size using methods like Concat, you’ll create a new array with the combined elements, but not directly modify the original array.

List: A list, on the other hand, is dynamic in size. You don’t need to specify its size when you create it, and it can grow or shrink as needed. In UiPath, lists are managed using the Add to Collection activity, which allows you to add elements one by one without worrying about the size limit.

Regards

@shashank

the difference is the inline modification and creation of new variable

in case of array when you modify array by adding items it would create new array

in case of list it will modify the current list only

cheers

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