Maximum value between six int32 variables

I am comparing the max and min of 6 variables which i calculated separately and then i would do a switch. The problem is, when i am doing max comparison using Math.Max(var1, var2, var3, var4, var5, var6), i am getting the below error.

“Overload resolution failed because no accessible ‘Max’ accepts this number of arguments”

Can someone help please. Started learning recently.

Hi @Goutham_Karanam

Math.Max Function only accepts 2 Variables/Values at a time for comparing

Instead of that use List to store N number of variables/values and the apply Linq on the same to find out Max from those Values

Below is the workflow for the same along with output :-

Mark as solution and like it if this helps you :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

Array of Integers will be your best choice here, create a variable of Integer[] type and Assign it to something like this:
MyArray=new Integer(5) { var0, var1, var2, var3, var4, var 5}
Then min will be and max will be like: