Working with Integer arrays in For Each

Hi Everyone, I am new to UI path and have been working on RPA Developer trainings. I was working on one of the assignments where I am trying to find out biggest and smallest numbers out of an array using for each loop. I am using following conditions:

  1. For each num in arrNumbers
  2. If num > maxNum, then maxNum = num
  3. If num < minNum, then minNum = num
    When I try to run the program, I am getting ArrayOutofRange exception. I am not sure what I am doing wrong. Would anyone please help me out?
    Thanks,
    Kush

Hi
Welcome to uipath community
To get the maximum value from a array of integer
Use this expression
Yourarrayvariable.Max.ToString
And for minimum value
Yourarrayvariable.Min.ToString

Cheers @kush_jn

2 Likes

Thanks so much for your answer, it is simple and effective.

1 Like

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