Finding the longest raycast from 10 different raycasts.

Hi,

I have created 10 raycasts and want to compare the length of these. I have tried using Mathf.Max to determine the largest but I get the error -

BCE0004: Ambiguous reference ‘Max’: UnityEngine.Mathf.Max(*int), UnityEngine.Mathf.Max(*float).

I am using the hit.distances from the raycasts to compare and I am unsure as to what kind of value type it returns.
If someone could help me figure this out it would be great.

float max = 0f;
for(int i = 0; i < distances.Length; i++) {
if (distances > max) max = distances*;*
}
If you don’t mind not using the built in function.

@JedBeryll
Doesn’t it count from 0 to nine to give a total of ten variables? Or does it not count the last number ie. 10 and will start from 0 and go up to 9? Anyway I will try making the new int [10]; and see if it works. Thanks for your help so far!